title: Connecting to POJOs trough TomEE plus server?
body: <p>I've created a Dynamic Web Project in Eclipse Kepler EE, connected it to a Tomee plus 1.7.1 server and created a servlet and a POJO. So after opening the browser and trying to do something with the classes, the servlet worked as expected, but the POJO returns error 404. </p>
  
  <p>The actual code is something like this: </p>
  
  <p>// The servlet </p>
  
  <pre><code>public class MyServlet extends HttpServlet {  
     public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {  
        PrintWriter out = response.getWriter();  
        out.println("I'm a servlet.");  
     }  
  }  
  </code></pre>
  
  <p>// the web.xml </p>
  
  <pre><code>&lt;servlet&gt;  
      &lt;servlet-name&gt;MyServlet&lt;/servlet-name&gt;  
      &lt;servlet-class&gt;package.MyServlet&lt;/servlet-class&gt;  
  &lt;/servlet&gt;  
  &lt;servlet-mapping&gt;  
      &lt;servlet-name&gt;MyServlet&lt;/servlet-name&gt;  
      &lt;url-pattern&gt;/MyServlet&lt;/url-pattern&gt;  
  &lt;/servlet-mapping&gt;  
  </code></pre>
  
  <p>So when I type "localhost:8080//MyServlet" I get the expected "I'm a servlet." message. The problem is with the POJO: </p>
  
  <p>//The POJO </p>
  
  <pre><code>@Path("/MyPOJO")  
  public class MyPOJO {  
     @GET  
     public String get() throws IOExeption {  
        return "I'm a POJO.";  
     }  
  }  
  </code></pre>
  
  <p>I have nothing about that class in the web.xml file. I have this class, that I don't really know what it does: </p>
  
  <pre><code> @ApplicationPath("/sth")  
      public class ApplicationConfig extends Application {      
          @Override  
          public Set&lt;Class&lt;?&gt;&gt; getClasses() {  
              return new HashSet&lt;Class&lt;?&gt;&gt;(Arrays.asList(MyPOJO.class));  
          }  
      }
  </code></pre>
  
  <p>Application is a class from M2_REPO\javax\ws\rs\javax.ws.rs-api\2.0.1\javax.ws.rs-api-2.0.1.jar </p>
  
  <p>So when I enter "localhost:8080//sth/MyPOJO", I get error 404, no exceptions no logs. I've tried to debug but it doesn't hit any breakpoints. </p>
  
  <p>Maybe it has something to do with the exception I get when I start the server: </p>
  
  <pre><code>Nov 19, 2014 6:44:50 PM org.apache.myfaces.ee6.MyFacesContainerInitializer onStartup 
  INFO: Added FacesServlet with mappings=[/faces/*, *.jsf, *.faces] 
  Nov 19, 2014 6:44:51 PM org.apache.myfaces.config.DefaultFacesConfigurationProvider getStandardFacesConfig 
  INFO: Reading standard config META-INF/standard-faces-config.xml 
  Nov 19, 2014 6:44:51 PM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces 
  SEVERE: An error occured while initializing MyFaces: WebAppBuilder not found in SystemInstance. Ensure the following entry exists in the Tomcat server.xml file: &lt;Listener className="org.apache.tomee.catalina.ServerListener"/&gt; 
  java.lang.IllegalStateException: WebAppBuilder not found in SystemInstance. Ensure the following entry exists in the Tomcat server.xml file: &lt;Listener className="org.apache.tomee.catalina.ServerListener"/&gt; 
  at org.apache.tomee.myfaces.TomEEAnnotationProvider.getAnnotatedClasses(TomEEAnnotationProvider.java:43) 
  at org.apache.myfaces.config.annotation.AnnotationConfigurator.createFacesConfig(AnnotationConfigurator.java:90) 
  at org.apache.myfaces.config.DefaultFacesConfigurationProvider.getAnnotationsFacesConfig(DefaultFacesConfigurationProvider.java:152) 
  at org.apache.myfaces.config.DefaultFacesConfigurationMerger.getFacesConfigData(DefaultFacesConfigurationMerger.java:91) 
  at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:416) 
  at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:370) 
  at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:73) 
  at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:143) 
  at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:119) 
  at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4937) 
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) 
  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.run(Unknown Source) 
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
  at java.lang.Thread.run(Unknown Source) 
  
  Nov 19, 2014 6:44:51 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom 
  INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [162] milliseconds. 
  Nov 19, 2014 6:44:59 PM org.apache.myfaces.ee6.MyFacesContainerInitializer onStartup 
  INFO: Added FacesServlet with mappings=[/faces/*, *.jsf, *.faces] 
  Nov 19, 2014 6:44:59 PM org.apache.myfaces.config.DefaultFacesConfigurationProvider getStandardFacesConfig 
  INFO: Reading standard config META-INF/standard-faces-config.xml 
  Nov 19, 2014 6:44:59 PM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces 
  SEVERE: An error occured while initializing MyFaces: WebAppBuilder not found in SystemInstance. Ensure the following entry exists in the Tomcat server.xml file: &lt;Listener className="org.apache.tomee.catalina.ServerListener"/&gt; 
  java.lang.IllegalStateException: WebAppBuilder not found in SystemInstance. Ensure the following entry exists in the Tomcat server.xml file: &lt;Listener className="org.apache.tomee.catalina.ServerListener"/&gt; 
  at org.apache.tomee.myfaces.TomEEAnnotationProvider.getAnnotatedClasses(TomEEAnnotationProvider.java:43) 
  at org.apache.myfaces.config.annotation.AnnotationConfigurator.createFacesConfig(AnnotationConfigurator.java:90) 
  at org.apache.myfaces.config.DefaultFacesConfigurationProvider.getAnnotationsFacesConfig(DefaultFacesConfigurationProvider.java:152) 
  at org.apache.myfaces.config.DefaultFacesConfigurationMerger.getFacesConfigData(DefaultFacesConfigurationMerger.java:91) 
  at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:416) 
  at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:370) 
  at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:73) 
  at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:143) 
  at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:119) 
  at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4937) 
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) 
  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.run(Unknown Source) 
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
  at java.lang.Thread.run(Unknown Source) 
  </code></pre>
  
  <p>I've tried to add the line that is missing in the server.xml file but then the server doesn't start at all. </p>
  
  <p>When my college tries to run it on his PC, it work with both the POJO and the Servlet. We can't find any reason why it's not running on my PC. </p>