title: Deploy a Java Enterprise Application fails
body: <p>Using Netbeans, I've created my Java Enterprise Application with a ejb module and a war module.
  I've done some changes in the war module and everything worked just fine. But now I'm trying to call an remote ejb defined in the ejb module. I've followed this tutorial <a href="https://netbeans.org/kb/docs/javaee/entappclient.html" rel="nofollow">https://netbeans.org/kb/docs/javaee/entappclient.html</a>.
  Now, when I try to deploy the ear file in my applicational server (JBoss AS7) I get the following error:</p>
  
  <blockquote>
    <p>{"JBAS014653: Composite operation failed and was rolled back. Steps
    that failed:" => {"Operation step-2" => {"JBAS014671: Failed services"
    => {"jboss.deployment.subunit.\"events.ear\".\"events-ejb.jar\".POST_MODULE"
    => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"events.ear\".\"events-ejb.jar\".POST_MODULE:
    Failed to process phase POST_MODULE of subdeployment
    \"events-ejb.jar\" of deployment \"events.ear\""}}}}
    /Users/Luis/NetBeansProjects/events/nbproject/build-impl.xml:307: The
    module has not been deployed.</p>
  </blockquote>
  
  <p>Why is this happening?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p><strong>teste-ejb module</strong>
  <strong>NewSessionBean</strong></p>
  
  <pre><code>package a;
  
  import javax.ejb.Stateless;
  
  @Stateless
  public class NewSessionBean implements NewSessionBeanRemote {
  
      // Add business logic below. (Right-click in editor and choose
      // "Insert Code &gt; Add Business Method")
  }
  </code></pre>
  
  <p><strong>teste-war module</strong> (not modified)</p>
  
  <p><strong>AuthenticationInterface</strong> (the java application)
  <strong>SessionbeanRemote</strong></p>
  
  <pre><code>package a;
  
  import javax.ejb.Remote;
  
  @Remote
  public interface NewSessionBeanRemote {
  
  }
  </code></pre>
  
  <p><strong>2º EDIT</strong></p>
  
  <blockquote>
    <p>17:59:24,759 WARN  [org.jboss.modules] (MSC service thread 1-4) Failed
    to define class a.NewSessionBean in Module
    "deployment.teste-ejb.jar:main" from Service Module Loader:
    java.lang.LinkageError: Failed to link a/NewSessionBean (Module
    "deployment.teste-ejb.jar:main" from Service Module Loader)
            at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)
            at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
            at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
            at org.jboss.modules.Module.loadModuleClass(Module.java:517)
            at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
            at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
            at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
            at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
            at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
            at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_51]
            at java.lang.Class.forName(Class.java:270) [rt.jar:1.7.0_51]
            at org.jboss.as.server.deployment.reflect.DeploymentClassIndex.classIndex(DeploymentClassIndex.java:54)
            at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:63)
    [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
            at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)
    [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
            at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113)
            at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
            at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    [rt.jar:1.7.0_51]
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    [rt.jar:1.7.0_51]
            at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51] Caused by: java.lang.NoClassDefFoundError: a/NewSessionBeanRemote
            at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_51]
            at java.lang.ClassLoader.defineClass(ClassLoader.java:800) [rt.jar:1.7.0_51]
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    [rt.jar:1.7.0_51]
            at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)
            at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)
            ... 19 more Caused by: java.lang.ClassNotFoundException: a.NewSessionBeanRemote from [Module "deployment.teste-ejb.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.performLoadClass(ConcurrentClassLoader.java:398)
            at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
            ... 24 more</p>
    
    <p>17:59:24,860 WARN  [org.jboss.modules] (MSC service thread 1-4) Failed
    to define class a.NewSessionBean in Module
    "deployment.teste-ejb.jar:main" from Service Module Loader:
    java.lang.LinkageError: Failed to link a/NewSessionBean (Module
    "deployment.teste-ejb.jar:main" from Service Module Loader)
            at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)
    [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
    [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
    [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.Module.loadModuleClass(Module.java:517) [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
    [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    [jboss-modules.jar:1.1.1.GA]
            at org.jboss.as.ejb3.deployment.processors.BusinessViewAnnotationProcessor.getEjbClass(BusinessViewAnnotationProcessor.java:225)
            at org.jboss.as.ejb3.deployment.processors.BusinessViewAnnotationProcessor.deploy(BusinessViewAnnotationProcessor.java:97)
            at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113)
    [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.runWorker(ThreadPoolExecutor.java:1145)
    [rt.jar:1.7.0_51]
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    [rt.jar:1.7.0_51]
            at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51] Caused by: java.lang.NoClassDefFoundError: a/NewSessionBeanRemote
            at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_51]
            at java.lang.ClassLoader.defineClass(ClassLoader.java:800) [rt.jar:1.7.0_51]
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    [rt.jar:1.7.0_51]
            at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)
    [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)
    [jboss-modules.jar:1.1.1.GA]
            ... 16 more Caused by: java.lang.ClassNotFoundException: a.NewSessionBeanRemote from [Module "deployment.teste-ejb.jar:main"
    from Service Module Loader]
            at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
    [jboss-modules.jar:1.1.1.GA]
            at 
    org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    [jboss-modules.jar:1.1.1.GA]</p>
    
    <p>17:59:24,970 ERROR [org.jboss.msc.service.fail] (MSC service thread
    1-4) MSC00001: Failed to start service
    jboss.deployment.unit."teste-ejb.jar".POST_MODULE:
    org.jboss.msc.service.StartException in service
    jboss.deployment.unit."teste-ejb.jar".POST_MODULE: Failed to process
    phase POST_MODULE of deployment "teste-ejb.jar"
            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.runWorker(ThreadPoolExecutor.java:1145)
    [rt.jar:1.7.0_51]
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    [rt.jar:1.7.0_51]
            at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51] Caused by:
    org.jboss.as.server.deployment.DeploymentUnitProcessingException:
    Could not load EJB class a.NewSessionBean
            at org.jboss.as.ejb3.deployment.processors.BusinessViewAnnotationProcessor.getEjbClass(BusinessViewAnnotationProcessor.java:227)
            at org.jboss.as.ejb3.deployment.processors.BusinessViewAnnotationProcessor.deploy(BusinessViewAnnotationProcessor.java:97)
            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.ClassNotFoundException: a.NewSessionBean from [Module "deployment.teste-ejb.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.performLoadClass(ConcurrentClassLoader.java:398)
            at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
            at org.jboss.as.ejb3.deployment.processors.BusinessViewAnnotationProcessor.getEjbClass(BusinessViewAnnotationProcessor.java:225)
            ... 7 more</p>
    
    <p>17:59:25,033 INFO  [org.jboss.as.server] (DeploymentScanner-threads -
    1) JBAS015870: Deploy of deployment "teste-ejb.jar" was rolled back
    with failure message {"JBAS014671: Failed services" =>
    {"jboss.deployment.unit.\"teste-ejb.jar\".POST_MODULE" =>
    "org.jboss.msc.service.StartException in service
    jboss.deployment.unit.\"teste-ejb.jar\".POST_MODULE: Failed to process
    phase POST_MODULE of deployment \"teste-ejb.jar\""}} 17:59:25,037 INFO
    [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015877:
    Stopped deployment teste-ejb.jar in 3ms 17:59:25,059 INFO 
    [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774:
    Service status report JBAS014777:   Services which failed to start:<br>
    service jboss.deployment.unit."teste-ejb.jar".POST_MODULE:
    org.jboss.msc.service.StartException in service
    jboss.deployment.unit."teste-ejb.jar".POST_MODULE: Failed to process
    phase POST_MODULE of deployment "teste-ejb.jar"</p>
    
    <p>17:59:25,071 ERROR [org.jboss.as.server.deployment.scanner]
    (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation
    failed and was rolled back. Steps that failed:" => {"Operation step-2"
    => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"teste-ejb.jar\".POST_MODULE" =>
    "org.jboss.msc.service.StartException in service
    jboss.deployment.unit.\"teste-ejb.jar\".POST_MODULE: Failed to process
    phase POST_MODULE of deployment \"teste-ejb.jar\""}}}}</p>
  </blockquote>
  
  <p>Thanks</p>