how to import java files from ejb module in web app?
<p>i create ear project and i have 2 module named:
mavenproject4-web
mavevnproject4-ejb</p>

<p>i try to import some interface and entity from ejb module in web module.But i can't.
i tried to add ejb module as dependency into web module by pom.xml.Then my problem fixed.Is it right way?</p>

<p>after adding dependency i tried to run project and i got this exception:</p>

<blockquote>
  <p>Severe:   Exception while preparing the app : Could not resolve a persistence unit corresponding to the persistence-context-ref-name [mysessionbeans.StudentDAOImpl/entityManager] in the scope of the module called [mavenproject4-ear#mavenproject4-ejb-1.0.jar]. Please verify your application.</p>
</blockquote>

<p>my persistence xml is in "src/main/resources" in ejb module.Detail information about project structure in image:
<a href="https://i.stack.imgur.com/PyNts.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PyNts.png" alt="enter image description here"></a></p>

<p>My web app pom.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;project xmlns="http://maven.apache.org/POM/4.0.0"  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0    
http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;parent&gt;
        &lt;artifactId&gt;mavenproject4&lt;/artifactId&gt;
        &lt;groupId&gt;az.lsim&lt;/groupId&gt;
        &lt;version&gt;1.0&lt;/version&gt;
    &lt;/parent&gt;

    &lt;groupId&gt;az.lsim&lt;/groupId&gt;
    &lt;artifactId&gt;mavenproject4-web&lt;/artifactId&gt;
    &lt;version&gt;1.0&lt;/version&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;

&lt;name&gt;mavenproject4-web&lt;/name&gt;

&lt;properties&gt;
    &lt;endorsed.dir&gt;${project.build.directory}/endorsed&lt;/endorsed.dir&gt;
    &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
&lt;/properties&gt;

&lt;dependencies&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;az.lsim&lt;/groupId&gt;
        &lt;artifactId&gt;mavenproject4-ear&lt;/artifactId&gt;
        &lt;version&gt;1.0&lt;/version&gt;
        &lt;type&gt;jar&lt;/type&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;javax&lt;/groupId&gt;
        &lt;artifactId&gt;javaee-web-api&lt;/artifactId&gt;
        &lt;version&gt;7.0&lt;/version&gt;
        &lt;scope&gt;provided&lt;/scope&gt;
    &lt;/dependency&gt;
&lt;/dependencies&gt;

&lt;build&gt;
    &lt;plugins&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
            &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
            &lt;version&gt;3.1&lt;/version&gt;
            &lt;configuration&gt;
                &lt;source&gt;1.7&lt;/source&gt;
                &lt;target&gt;1.7&lt;/target&gt;
                &lt;compilerArguments&gt;
                    &lt;endorseddirs&gt;${endorsed.dir}&lt;/endorseddirs&gt;
                &lt;/compilerArguments&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
            &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.3&lt;/version&gt;
            &lt;configuration&gt;
                &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
            &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.6&lt;/version&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;phase&gt;validate&lt;/phase&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;copy&lt;/goal&gt;
                    &lt;/goals&gt;
                    &lt;configuration&gt;
                        &lt;outputDirectory&gt;${endorsed.dir}&lt;/outputDirectory&gt;
                        &lt;silent&gt;true&lt;/silent&gt;
                        &lt;artifactItems&gt;
                            &lt;artifactItem&gt;
                                &lt;groupId&gt;javax&lt;/groupId&gt;
                                &lt;artifactId&gt;javaee-endorsed-api&lt;/artifactId&gt;
                                &lt;version&gt;7.0&lt;/version&gt;
                                &lt;type&gt;jar&lt;/type&gt;
                            &lt;/artifactItem&gt;
                        &lt;/artifactItems&gt;
                    &lt;/configuration&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
        &lt;/plugin&gt;
    &lt;/plugins&gt;
&lt;/build&gt;
</code></pre>

<p></p>

<p>Thanks</p>