title: jersey NoClassDefFoundError: org/objectweb/asm/ClassVisitor exception
body: <p>First time I'm trying a WebService using jersey. The below code I got from some blog.
   I am getting following 500 error when I'm trying Java Web service using jersey client</p>
  
  <pre><code>javax.servlet.ServletException: Servlet.init() for servlet Jersey Root REST Service threw exception
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
      java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      java.lang.Thread.run(Unknown Source)
  
  root cause
  
  java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
      com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:79)
      com.sun.jersey.api.core.servlet.WebAppResourceConfig.init(WebAppResourceConfig.java:102)
      com.sun.jersey.api.core.servlet.WebAppResourceConfig.&lt;init&gt;(WebAppResourceConfig.java:89)
      com.sun.jersey.api.core.servlet.WebAppResourceConfig.&lt;init&gt;(WebAppResourceConfig.java:74)
      com.sun.jersey.spi.container.servlet.WebComponent.getWebAppResourceConfig(WebComponent.java:672)
      com.sun.jersey.spi.container.servlet.ServletContainer.getDefaultResourceConfig(ServletContainer.java:415)
      com.sun.jersey.spi.container.servlet.ServletContainer.getDefaultResourceConfig(ServletContainer.java:582)
      com.sun.jersey.spi.container.servlet.WebServletConfig.getDefaultResourceConfig(WebServletConfig.java:87)
      com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:703)
      com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:678)
      com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:203)
      com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:374)
      com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:557)
      javax.servlet.GenericServlet.init(GenericServlet.java:160)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
      java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      java.lang.Thread.run(Unknown Source)'
  </code></pre>
  
  <p>Below is my web.xml file </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_3_0.xsd" id="WebApp_ID" version="3.0"&gt;
    &lt;display-name&gt;RestFulWeb&lt;/display-name&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
  
     &lt;servlet&gt;
      &lt;servlet-name&gt;Jersey Root 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.api.json.POJOMappingFeature&lt;/param-name&gt;
    &lt;param-value&gt;true&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 Root REST Service&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;'
  </code></pre>
  
  <p>Here i tried adding the package also that didn't help:</p>
  
  <p>Added only one jar file jersey-bundle-1.14.jar. The following is my Jersey server</p>
  
  <pre><code>package com.rest.server;
  
  import javax.ws.rs.DELETE;
  import javax.ws.rs.GET;
  import javax.ws.rs.POST;
  import javax.ws.rs.PUT;
  import javax.ws.rs.Path;
  import javax.ws.rs.PathParam;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.MediaType;
  
  import com.rest.data.Hello;
  
  // POJO, no interface no extends
  
  // The class registers its methods for the HTTP GET request using the @GET annotation. 
  // Using the @Produces annotation, it defines that it can deliver several MIME types,
  // text, XML and HTML. 
  
  // The browser requests per default the HTML MIME type.
  
  //Sets the path to base URL + /hello
  @Path("/hello")
  public class HelloWorldRest {
  
   @GET
   @Path("/{param}/")
   public String getMsg(@PathParam("param") String msg) {
  
    String output = "Jersey say : " + msg;
  
    return output;
  
   }
   @GET
   @Path("/world")
   public String getFixedMsg(String msg) {
  
    String output = "Jersey say : fixed path" + msg;
  
    return output;
  
   }
   // This method is called if TEXT_PLAIN is request
   @GET
   //@Path("helloworld")
   @Produces(MediaType.TEXT_PLAIN)
   public String sayPlainTextHello() {
    System.out.println("sayPlain");
    return "Hello Jersey";
   }
  
   // This method is called if XML is request
   @GET
   //@Path("helloworld")
   @Produces(MediaType.TEXT_XML)
   public String sayXMLHello() {
    System.out.println("sayXML");
    return "" + " Hello Jersey" + "";
   }
  
   // This method is called if HTML is request
   @GET
   //@Path("helloworld")
   @Produces(MediaType.TEXT_HTML)
   public String sayHtmlHello() {
    System.out.println("sayHTML");
    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; ";
   }
  
   // This method is called if JSON is request
   @GET
   //@Path("helloworld")
   @Produces(MediaType.APPLICATION_JSON)
   public Hello sayJsonHello() {
    return new Hello("Hello", "Jersey");
   }
  
   @POST
   @Produces(MediaType.APPLICATION_JSON)
   public Hello createHello(Hello hello)
   {
    System.out.println("post");
    return hello;
   }
  
  }'
  </code></pre>
  
  <p>currently I'm trying only with GET hitting the following url <code>http://localhost:8080/RestFulWeb/hello</code>, I am getting the 505 error. </p>
  
  <p>DO i missed any jar files , but i didn't get any compile time error.</p>