title: Debug IncompatibleClassChangeError with Maven, Jersey, Tomcat, @ApplicationPath, no web.xml
body: <p>If I try to load any resource urls, I get the following exception:</p>
  
  <pre><code>javax.servlet.ServletException: Servlet.init() for servlet com.example.project.Application threw exception
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
      org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>root cause</p>
  
  <pre><code>java.lang.IncompatibleClassChangeError: org/glassfish/jersey/server/internal/scanning/AnnotationAcceptingListener$AnnotatedClassVisitor
      org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener.&lt;init&gt;(AnnotationAcceptingListener.java:143)
      org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener.newJaxrsResourceAndProviderListener(AnnotationAcceptingListener.java:115)
      org.glassfish.jersey.server.ResourceConfig.scanClasses(ResourceConfig.java:884)
      org.glassfish.jersey.server.ResourceConfig._getClasses(ResourceConfig.java:849)
      org.glassfish.jersey.server.ResourceConfig.getClasses(ResourceConfig.java:755)
      com.sun.jersey.server.impl.application.DeferredResourceConfig$ApplicationHolder.&lt;init&gt;(DeferredResourceConfig.java:92)
      com.sun.jersey.server.impl.application.DeferredResourceConfig$ApplicationHolder.&lt;init&gt;(DeferredResourceConfig.java:79)
      com.sun.jersey.server.impl.application.DeferredResourceConfig.getApplication(DeferredResourceConfig.java:76)
      com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1164)
      com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180)
      com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799)
      com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795)
      com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
      com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795)
      com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)
      com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:491)
      com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:321)
      com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
      com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
      com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:376)
      com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:559)
      javax.servlet.GenericServlet.init(GenericServlet.java:158)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
      org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>I've been led to believe this may be because of incompatible versions. I made my WAR file with maven. The <code>&lt;dependencies&gt;</code> in my <code>pom.xml</code> look like this:</p>
  
  <pre><code> &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-container-grizzly2-http&lt;/artifactId&gt;
      &lt;/dependency&gt;
       &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-media-moxy&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;!-- Viewable and @Template --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.ext&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-mvc-mustache&lt;/artifactId&gt;
          &lt;version&gt;2.12&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- JUNIT --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;4.9&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;!-- hibernate --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;4.3.6.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- for JPA, use hibernate-entitymanager instead of hibernate-core --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
          &lt;version&gt;4.3.6.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- Hibernate uses slf4j for logging, for our purposes here use the simple backend --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-simple&lt;/artifactId&gt;
          &lt;version&gt;1.6.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- Hibernate gives you a choice of bytecode providers between cglib and javassist --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javassist&lt;/groupId&gt;
          &lt;artifactId&gt;javassist&lt;/artifactId&gt;
          &lt;version&gt;3.12.0.GA&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- The tutorials use the H2 in-memory database --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.h2database&lt;/groupId&gt;
          &lt;artifactId&gt;h2&lt;/artifactId&gt;
          &lt;version&gt;1.2.140&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- needed for web.xml-less deploy --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-servlet&lt;/artifactId&gt;
          &lt;version&gt;1.18.1&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>How do I debug this traceback?</p>