title: Why Wildfly 8.1.0 final return java.lang.NoClassDefFoundError: when deploying ejb module with a remote application library but glassfish doesn’t?
body: <p>I tried to create a simple EJB remote client sample but I keep getting <code>java.lang.NoClassDefFoundError:</code> any time I tried to deploy the EJB. </p>
  
  <p>The Remote Java Library File Structure is:</p>
  
  <blockquote>
  <pre><code>&gt; TestRemoteInterface     
      --Source Package      
         -- bean
            --TestBeanRemote.java   
      -- Libraries      
         -- Java EE 6 API Library       
         --JDK 1.8
  </code></pre>
  </blockquote>
  
  <p>The EJB Module File Structure is:</p>
  
  <blockquote>
  <pre><code>&gt; TestEJBModule   
      --Source Package      
         -- bean
            --TestBean.java     
      -- Libraries  
         -- TestRemoteInterface – dist/TestRemoteInterface    
         -- Java EE 6 API Library       
         -- JDK 1.8
  </code></pre>
  </blockquote>
  
  <p>TestBeanRemote.java</p>
  
  <pre><code>package bean;
  import javax.ejb.Remote;
  
  @Remote
  public interface TestBeanRemote {
  
      String getName(String name);
  
  }
  </code></pre>
  
  <p>TestBean .java</p>
  
  <blockquote>
    <p>package bean;</p>
    
    <p>import javax.ejb.Stateless;</p>
    
    <p>@Stateless public class TestBean implements TestBeanRemote {</p>
  
  <pre><code>@Override
  public String getName(String name) {
      return "Here is my " + name;
  }    }
  </code></pre>
  </blockquote>
  
  <p>Question: When I try to deploy the TestEJBModule on get the follow log:</p>
  
  <blockquote>
    <p>WARN  [org.jboss.modules] (MSC service thread 1-6) Failed to define
    class bean.TestBean in Module "deployment.TestEJBModule.jar:main" from
    Service Module Loader: java.lang.LinkageError: Failed to link
    bean/TestBean (Module "deployment.TestEJBModule.jar:main" from Service
    Module Loader)</p>
  </blockquote>
  
  <p>....</p>
  
  <pre><code>Caused by: java.lang.NoClassDefFoundError: bean/TestBeanRemote
      at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.8.0_05]
  </code></pre>
  
  <p>....</p>
  
  <blockquote>
    <p>Caused by: java.lang.ClassNotFoundException: bean.TestBeanRemote from
    [Module "deployment.TestEJBModule.jar:main" from Service Module
    Loader]   at
    org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213)
    [jboss-modules.jar:1.3.3.Final]</p>
  </blockquote>
  
  <p>...</p>
  
  <blockquote>
    <p>Caused by: java.lang.LinkageError: Failed to link bean/TestBean
    (Module "deployment.TestEJBModule.jar:main" from Service Module
    Loader)   at
    org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:487)
    [jboss-modules.jar:1.3.3.Final]
    .....</p>
    
    <p>Caused by: java.lang.NoClassDefFoundError: bean/TestBeanRemote</p>
  </blockquote>
  
  <p>.....</p>
  
  <blockquote>
    <p>Caused by: java.lang.ClassNotFoundException: bean.TestBeanRemote from
    [Module "deployment.TestEJBModule.jar:main" from Service Module
    Loader]   at
    org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213)
    [jboss-modules.jar:1.3.3.Final]</p>
  </blockquote>
  
  <p>When I tried to deploy this same sample with Glassfish 4. It works fine.</p>
  
  <p><strong>NB: I am using netbeans 8.0.1</strong></p>
  
  <p>There appear to be a similar <a href="https://stackoverflow.com/questions/26690027/wildfly-8-host-ejb-3-x-application-problems">thread</a> but it didn't help much. Thank you in advance.</p>