title: How to deploy EJB project and JPA project in EAR project
body: <p>I create 2 projects one is EJB and one is JPA. JPA project define entities classes, and persistent.xml. EBJ project import JPA project, I defined EJB session bean to connect database by entity manager. please refer below image for details. But when running on Jboss 7, error happend.</p>
  
  <p><img src="https://i.stack.imgur.com/Rs4v0.png" alt="enter image description here"></p>
  
  <pre><code>03:23:59,546 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.subunit."TestApps.ear"."TestEJB.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."TestApps.ear"."TestEJB.jar".POST_MODULE: Failed to p
  rocess phase POST_MODULE of subdeployment "TestEJB.jar" of deployment "TestApps.ear"
          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [rt.jar:1.6.0_22]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_22]
          at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_22]
  Caused by: java.lang.RuntimeException: Error getting reflective information for class com.ejb.services.LotUpdatManagerBean with ClassLoader ModuleClassLoader for Module "deployment.TestApps.ear.TestEJB.jar:main" from Service Module Loader
          at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
          at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)
          at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)
          at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)
          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
          ... 5 more
  Caused by: java.lang.NoClassDefFoundError: com/test/model/LotUpdates
          at java.lang.Class.getDeclaredMethods0(Native Method) [rt.jar:1.6.0_22]
          at java.lang.Class.privateGetDeclaredMethods(Unknown Source) [rt.jar:1.6.0_22]
          at java.lang.Class.getDeclaredMethods(Unknown Source) [rt.jar:1.6.0_22]
          at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.&lt;init&gt;(ClassReflectionIndex.java:65) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
          ... 10 more
  Caused by: java.lang.ClassNotFoundException: com.test.model.LotUpdates from [Module "deployment.TestApps.ear.TestEJB.jar:main" from Service Module Loader]
          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
          ... 15 more
  
  03:23:59,762 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "TestApps.ear" was rolled back with failure message {"JBAS014671: Failed services" =&gt; {"jboss.deployment.subunit.\"TestApps.ear\".\"TestEJB.jar\".POST_MODULE" =&gt; "org.jboss.msc.service.StartExce
  ption in service jboss.deployment.subunit.\"TestApps.ear\".\"TestEJB.jar\".POST_MODULE: Failed to process phase POST_MODULE of subdeployment \"TestEJB.jar\" of deployment \"TestApps.ear\""}}
  03:23:59,765 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment TestEJB.jar in 2ms
  03:23:59,767 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment TestApps.ear in 4ms
  03:23:59,768 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
  JBAS014777:   Services which failed to start:      service jboss.deployment.subunit."TestApps.ear"."TestEJB.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."TestApps.ear"."TestEJB.jar".POST_MODULE: Failed to process phase POST_MODULE of subdeployment "TestE
  JB.jar" of deployment "TestApps.ear"
  </code></pre>
  
  <p>I'm failed. Anyone can correct me, Show me the way to deploy(jpa project and ejb project in same ear).</p>