title: EJB Stateless Bean cannot be found. Injection fails
body: <p>I have two Modules WAR and Business. </p>
  
  <p>I try to inject a stateless bean in web module. But the stateless bean can not be found?</p>
  
  <p>Where is the error? Any Idea??</p>
  
  <p>In Business Module:</p>
  
  <pre><code>@Stateless
  public class BusinessFacade {
  
      public void processEntity(final MyEntitiy entity) {
          System.out.println(entity.getName());
      }
  
  }
  </code></pre>
  
  <p>In WAR Module:</p>
  
  <pre><code>@ManagedBean
  @SessionScoped
  public class HelloBean implements Serializable {
  
      @EJB
      BusinessFacade businessFacade;
  
      private static final long serialVersionUID = 1L;
  
      private String name;
  
      public String getName() {
          return name;
      }
  
      public void setName(final String name) {
          this.name = name;
      }
  }
  </code></pre>
  
  <p>The Error:</p>
  
  <pre><code>[31.08.12 10:19:38:835 CEST] 00000018 webapp        E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
                                   java.lang.NoClassDefFoundError: com.myproject.business.beans.BusinessFacade
      at java.lang.Class.getDeclaredFieldsImpl(Native Method)
      at java.lang.Class.getDeclaredFields(Class.java:544)
      at org.apache.myfaces.config.annotation.AnnotationConfigurator.fields(AnnotationConfigurator.java:846)
      at org.apache.myfaces.config.annotation.AnnotationConfigurator.createFacesConfig(AnnotationConfigurator.java:328)
      at org.apache.myfaces.config.annotation.AnnotationConfigurator.createFacesConfig(AnnotationConfigurator.java:94)
      at org.apache.myfaces.config.DefaultFacesConfigurationProvider.getAnnotationsFacesConfig(DefaultFacesConfigurationProvider.java:148)
      at org.apache.myfaces.config.DefaultFacesConfigurationMerger.getFacesConfigData(DefaultFacesConfigurationMerger.java:91)
  
  ....
  ..
  
  Caused by: java.lang.ClassNotFoundException: com.myproject.business.beans.BusinessFacade
      at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
      at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:198)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:646)
      at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:113)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:612)
      at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
      at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
      at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:564)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:612)
      at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:564)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:612)
      ... 33 more
  </code></pre>