title: HTTPstatus 500 in deploying Jersey based Restful service project
body: <p>I have recently started with Jersey following <a href="http://www.vogella.com/articles/REST/article.html" rel="nofollow">this</a> tutorial. I have configured the services/package name in web.xml alright, Now the thing is I am getting an javax.servlet.ServletException: Servlet.init() Exception with the following stack trace below:</p>
  
  <pre><code>exception
  
  javax.servlet.ServletException: Servlet.init() for servlet Jersey REST Service threw exception
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      java.lang.Thread.run(Unknown Source)
  root cause
  
  com.sun.jersey.spi.inject.Errors$ErrorMessagesException
      com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170)
      com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136)
      com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199)
      com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:771)
      com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:766)
      com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:488)
      com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:318)
      com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:609)
      com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210)
      com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373)
      com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556)
      javax.servlet.GenericServlet.init(GenericServlet.java:212)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>Here is my Jes.java Class file:</p>
  
  <pre><code>package webb;
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.MediaType;
  
  @Path("/Jes")
  public class Jes {
  
        @GET
        @Produces(MediaType.TEXT_PLAIN)
        public String sayPlainTextHello() {
              return "Hello Jersey";
            }
  
        @GET
        @Produces(MediaType.TEXT_PLAIN)
        public String sayXMLHello() {
              return "&lt;?xml version=\"1.0\"?&gt;" + "&lt;hello&gt; Hello Jersey" + "&lt;/hello&gt;";
            }
  
            // This method is called if HTML is request
            @GET
            @Produces(MediaType.TEXT_HTML)
            public String sayHtmlHello() {
              return "&lt;html&gt; " + "&lt;title&gt;" + "Hello Jersey" + "&lt;/title&gt;"
                  + "&lt;body&gt;&lt;h1&gt;" + "Hello Jersey" + "&lt;/body&gt;&lt;/h1&gt;" + "&lt;/html&gt; ";
            }
  
      public static void main(String[] args) {
      }
  
  }
  </code></pre>
  
  <p>And web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt;
    &lt;display-name&gt;webb&lt;/display-name&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;Jersey REST Service&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.sun.jersey.spi.container.servlet.ServletContainer&lt;/servlet-class&gt;
      &lt;init-param&gt;
        &lt;param-name&gt;com.sun.jersey.config.property.packages&lt;/param-name&gt;
        &lt;param-value&gt;webb&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Jersey REST Service&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/rest/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Here is my application setup:</p>
  
  <p>Apache Tomcat 6.0<br />
  Jersey-core-1.8.jar<br />
  Jersey-bundle-1.8.jar<br />
  asm-3.1.jar<br />
  JRE7<br />
  Windows 64 bit<br /></p>
  
  <p><strong>-></strong> I am not able to figure out what is causing this com.sun.jersey.spi.inject.Errors$ErrorMessagesException, answers related to similar problem are welcome.</p>