title: Jersey 2.32 IllegalArgumentException jersey.repackaged.org.objectweb.asm.ClassVisitor
body: <p>I am trying to user Jersey's JSON/bean validation however error occurs when initing servlet occurs.</p>
  <p>Full stack trace:</p>
  <pre><code>SEVERE: Servlet.init() for servlet [rest-servlet] threw exception
  java.lang.IllegalArgumentException
      at jersey.repackaged.org.objectweb.asm.ClassVisitor.&lt;init&gt;(ClassVisitor.java:79)
      at jersey.repackaged.org.objectweb.asm.ClassVisitor.&lt;init&gt;(ClassVisitor.java:64)
      at org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener$AnnotatedClassVisitor.&lt;init&gt;(AnnotationAcceptingListener.java:172)
      at org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener$AnnotatedClassVisitor.&lt;init&gt;(AnnotationAcceptingListener.java:156)
      at org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener.&lt;init&gt;(AnnotationAcceptingListener.java:124)
      at org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener.newJaxrsResourceAndProviderListener(AnnotationAcceptingListener.java:96)
      at org.glassfish.jersey.server.ResourceConfig.scanClasses(ResourceConfig.java:902)
      at org.glassfish.jersey.server.ResourceConfig._getClasses(ResourceConfig.java:863)
      at org.glassfish.jersey.server.ResourceConfig.getClasses(ResourceConfig.java:772)
      at org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.&lt;init&gt;(ResourceConfig.java:1213)
      at org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.&lt;init&gt;(ResourceConfig.java:1186)
      at org.glassfish.jersey.server.ResourceConfig.createRuntimeConfig(ResourceConfig.java:1182)
      at org.glassfish.jersey.server.ApplicationHandler$RuntimeConfigConfigurator.init(ApplicationHandler.java:182)
      at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$0(ApplicationHandler.java:290)
      at java.util.Arrays$ArrayList.forEach(Arrays.java:3880)
      at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:290)
      at org.glassfish.jersey.server.ApplicationHandler.&lt;init&gt;(ApplicationHandler.java:259)
      at org.glassfish.jersey.servlet.WebComponent.&lt;init&gt;(WebComponent.java:311)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:154)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:347)
      at javax.servlet.GenericServlet.init(GenericServlet.java:158)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1134)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1089)
      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:761)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590)
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:748)
  </code></pre>
  <p>pom.xml:</p>
  <pre><code>&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
      xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
      xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;eu.itreegroup&lt;/groupId&gt;
      &lt;artifactId&gt;admin3-iasm&lt;/artifactId&gt;
      &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;name&gt;Admin3-IASM&lt;/name&gt;
  
      &lt;properties&gt;
          &lt;jackson.version&gt;2.11.3&lt;/jackson.version&gt;
          &lt;jersey.version&gt;2.32&lt;/jersey.version&gt;
      &lt;/properties&gt;
  
      &lt;prerequisites&gt;
          &lt;maven&gt;3.6.3&lt;/maven&gt;
      &lt;/prerequisites&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;maven-ojdbc6&lt;/id&gt;
              &lt;name&gt;Maven ojdbc6 Repository&lt;/name&gt;
              &lt;url&gt;http://www.datanucleus.org/downloads/maven2&lt;/url&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
  
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
                  &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
                  &lt;version&gt;2.5&lt;/version&gt;
                  &lt;scope&gt;provided&lt;/scope&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  
      &lt;dependencies&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.ow2.asm&lt;/groupId&gt;
              &lt;artifactId&gt;asm&lt;/artifactId&gt;
              &lt;version&gt;8.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-annotations&lt;/artifactId&gt;
              &lt;version&gt;${jackson.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
              &lt;version&gt;${jackson.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
              &lt;version&gt;${jackson.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.jaxrs&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-jaxrs-base&lt;/artifactId&gt;
              &lt;version&gt;${jackson.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.jaxrs&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-jaxrs-json-provider&lt;/artifactId&gt;
              &lt;version&gt;${jackson.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
  &lt;!-- 
  &lt;dependency&gt;
      &lt;groupId&gt;jakarta.annotation&lt;/groupId&gt;
      &lt;artifactId&gt;jakarta.annotation-api&lt;/artifactId&gt;
      &lt;version&gt;2.0.0-RC1&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;jakarta.validation&lt;/groupId&gt;
      &lt;artifactId&gt;jakarta.validation-api&lt;/artifactId&gt;
      &lt;version&gt;3.0.0&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;jakarta.ws.rs&lt;/groupId&gt;
      &lt;artifactId&gt;jakarta.ws.rs-api&lt;/artifactId&gt;
      &lt;version&gt;3.0.0-M1&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
      &lt;artifactId&gt;javax.ws.rs-api&lt;/artifactId&gt;
      &lt;version&gt;2.1.1&lt;/version&gt;
  &lt;/dependency&gt;
          --&gt;
          
          &lt;dependency&gt;
              &lt;groupId&gt;javassist&lt;/groupId&gt;
              &lt;artifactId&gt;javassist&lt;/artifactId&gt;
              &lt;version&gt;3.12.1.GA&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.ext&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-bean-validation&lt;/artifactId&gt;
              &lt;version&gt;${jersey.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-client&lt;/artifactId&gt;
              &lt;version&gt;${jersey.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-common&lt;/artifactId&gt;
              &lt;version&gt;${jersey.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-container-servlet&lt;/artifactId&gt;
              &lt;version&gt;${jersey.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-container-servlet-core&lt;/artifactId&gt;
              &lt;version&gt;${jersey.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.inject&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-hk2&lt;/artifactId&gt;
              &lt;version&gt;${jersey.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-media-json-jackson&lt;/artifactId&gt;
              &lt;version&gt;${jersey.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-server&lt;/artifactId&gt;
              &lt;version&gt;${jersey.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
              &lt;artifactId&gt;jsr311-api&lt;/artifactId&gt;
              &lt;version&gt;1.1.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.17&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;oracle&lt;/groupId&gt;
              &lt;artifactId&gt;ojdbc6&lt;/artifactId&gt;
              &lt;version&gt;11.2.0.3&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.8.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;javaEncoding&gt;UTF-8&lt;/javaEncoding&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  <p>Line which supposedly throws exception:</p>
  <pre><code>...
    public ClassVisitor(final int api, final ClassVisitor classVisitor) {
      if (api != Opcodes.ASM8
          &amp;&amp; api != Opcodes.ASM7
          &amp;&amp; api != Opcodes.ASM6
          &amp;&amp; api != Opcodes.ASM5
          &amp;&amp; api != Opcodes.ASM4
          &amp;&amp; api != Opcodes.ASM9_EXPERIMENTAL) {
        throw new IllegalArgumentException(&quot;Unsupported api &quot; + api);
      }
      if (api == Opcodes.ASM9_EXPERIMENTAL) {
        Constants.checkAsmExperimental(this); // Line which supposedly throws exception
      }
      this.api = api;
      this.cv = classVisitor;
    }
  ... 
  </code></pre>
  <p><strong>UPDATE:</strong>
  Using Java 8</p>
  <p>some more text so that I could post this question some more text so that I could post this question some more text so that I could post this question some more text so that I could post this question some more text so that I could post this question some more text so that I could post this question</p>