title: How do I create/set up/use an EJB project with a web app project in TomEE Plus/Eclipse?
body: <p>I am trying to use an EJB project with a web app project in TomEE Plus and Eclipse. I can use a no interface bean in the web app project but when I create a new EJB project, configure build path on the web app to include the EJB project, TomEE will not start.</p>
  
  <p>I set TomEE to Use Tomcat Installation in the Server Locations pane of TomEE properties in Eclipse. If I don't, I cannot even access the EJB in the same package as the Servlet.</p>
  
  <p>The code is trivial:</p>
  
  <pre><code>package mypackage;
  
  import java.io.IOException;
  // Package containing remote interface and bean implementation
  // Remaining imports omitted
  import beans.* ; 
  @WebServlet("/HelloServlet")
  public class HelloServlet extends HttpServlet {
      private static final long serialVersionUID = 1L;
  
      @EJB
      HelloSBNoI hb ;             // The bean located within this project (same package as servlet)
  
      @EJB
      HelloBeanRemote hbfejb ;    // The bean located in an ejb project
  
      protected void doGet(HttpServletRequest request, HttpServletResponse response) 
                     throws ServletException, IOException {
          response.setContentType("text/html"); ;
          response.getWriter( ).write("Hello From Servlet &lt;br /&gt;");
          response.getWriter( ).write("Hello From EJB in same package" + hb.from( ) );
          response.getWriter( ).write("&lt;br /&gt;Hello From EJB in different project" +
                                       hbfejb.sayHelloEJB( ) );
      }
  }
  </code></pre>
  
  <p>And here's TomEE trying to start, but failing:</p>
  
  <blockquote>
    <p>Jul 21, 2014 1:24:47 PM org.apache.catalina.core.ContainerBase startInternal
    SEVERE: A child container failed during start
    java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/useremoteejb]]
        at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
        at java.util.concurrent.FutureTask.get(FutureTask.java:111)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:799)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/useremoteejb]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
        ... 7 more</p>
  </blockquote>
  
  <p>Caused by: java.lang.NoClassDefFoundError: Lbeans/HelloBeanRemote;</p>
  
  <pre><code>at java.lang.Class.getDeclaredFields0(Native Method)
  at java.lang.Class.privateGetDeclaredFields(Class.java:2308)
  at java.lang.Class.getDeclaredFields(Class.java:1760)
  at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
  at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261)
  at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:140)
  at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
  at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:400)
  at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:876)
  at org.apache.tomee.catalina.OpenEJBContextConfig.configureStart(OpenEJBContextConfig.java:113)
  at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:371)
  at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
  at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5355)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  ... 7 more
  Caused by: java.lang.ClassNotFoundException: beans.HelloBeanRemote
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
  at org.apache.tomee.catalina.LazyStopWebappClassLoader.loadClass(LazyStopWebappClassLoader.java:143)
  ... 22 more
  </code></pre>
  
  <p>I've spent hours trying to figure out what seems like a simple configuration error!</p>
  
  <p>Thanks in advance for your expert assistance</p>