title: How to configure jax-rs web service web.xml properly
body: <p>I am trying to implement a jax-rs web service using jersey framework. I have written the web service but I don't fully understand what the web.xml tags mean so I don't know if I have configured it correct but when I try to access the service I get an error. Here is the web service:</p>
  
  <pre><code>package org.LMS.Controller;
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.MediaType;
  
  @Path ("/test")
  public class Test {
      private String name = "Worked";
  
      @GET
      @Produces (MediaType.APPLICATION_XHTML_XML)
      public String getTest ()
      {
          return name;
      }
  }
  </code></pre>
  
  <p>my web.xml is:</p>
  
  <pre><code> &lt;!-- Test web service mapping --&gt;
    &lt;servlet&gt; 
      &lt;display-name&gt;Test&lt;/display-name&gt;
      &lt;servlet-name&gt;Test&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.LMS.Controller&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;org.LMS.Controller.Test&lt;/param-name&gt;
          &lt;param-value&gt;eduscope&lt;/param-value&gt;
      &lt;/init-param&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Test&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/test&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;!--end Test web service mapping --&gt;
  </code></pre>
  
  <p>and this is the error I'm getting when I try to access my application:
  HTTP Status 500 -
  type Exception report
  message</p>
  
  <p>description The server encountered an internal error () that prevented it from fulfilling this request.</p>
  
  <p>exception</p>
  
  <pre><code>javax.servlet.ServletException: Wrapper cannot find servlet class org.LMS.Controller or a class it depends on
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      java.lang.Thread.run(Thread.java:679)
  root cause
  
  java.lang.ClassNotFoundException: org.LMS.Controller
      org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
      org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      java.lang.Thread.run(Thread.java:679)
  </code></pre>
  
  <p>Can you guys tell me what I'm doing wrong and explain what each tag in the web.xml file means has it relates to web services</p>