title: Migrate Jersey project to use Java 10 results in java.lang.IllegalArgumentException at jersey.repackaged.org.objectweb.asm.ClassReader.<init>
body: <p>Previously, when the project was on Tomcat 8 and Java 8, it was working fine, but after I migrated my project to Tomcat 9 and Java 10, it is giving me error as follows:</p>
  <pre class="lang-none prettyprint-override"><code>Oct 05, 2018 11:02:01 AM org.apache.catalina.core.ApplicationContext log
  SEVERE: StandardWrapper.Throwable
  java.lang.IllegalArgumentException
      at jersey.repackaged.org.objectweb.asm.ClassReader.&lt;init&gt;(ClassReader.java:170)
      at jersey.repackaged.org.objectweb.asm.ClassReader.&lt;init&gt;(ClassReader.java:153)
      at jersey.repackaged.org.objectweb.asm.ClassReader.&lt;init&gt;(ClassReader.java:424)
      at org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener.process(AnnotationAcceptingListener.java:170)
      at org.glassfish.jersey.server.ResourceConfig.scanClasses(ResourceConfig.java:915)
      at org.glassfish.jersey.server.ResourceConfig._getClasses(ResourceConfig.java:869)
      at org.glassfish.jersey.server.ResourceConfig.getClasses(ResourceConfig.java:775)
      at org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.&lt;init&gt;(ResourceConfig.java:1206)
      at org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.&lt;init&gt;(ResourceConfig.java:1178)
      at org.glassfish.jersey.server.ResourceConfig.createRuntimeConfig(ResourceConfig.java:1174)
      at org.glassfish.jersey.server.ApplicationHandler.&lt;init&gt;(ApplicationHandler.java:345)
      at org.glassfish.jersey.servlet.WebComponent.&lt;init&gt;(WebComponent.java:392)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369)
      at javax.servlet.GenericServlet.init(GenericServlet.java:158)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1124)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1079)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:971)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4829)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5143)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1429)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
      at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
      at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
      at java.base/java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
      at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1429)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
      at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
      at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
      at java.base/java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
      at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:261)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
      at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
      at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.base/java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
  </code></pre>
  <p>My pom.xml file is:</p>
  <pre class="lang-xml prettyprint-override"><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/maven-v4_0_0.xsd&quot;&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;com.BAE&lt;/groupId&gt;
    &lt;artifactId&gt;BAE&lt;/artifactId&gt;
    &lt;version&gt;1.0.1-SNAPSHOT&lt;/version&gt;
    &lt;name&gt;BAE Maven Webapp&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
    &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;/properties&gt;
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;3.8.1&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/org./mockito-all --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.mockito&lt;/groupId&gt;
          &lt;artifactId&gt;mockito-all&lt;/artifactId&gt;
          &lt;version&gt;1.9.5&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
           &lt;dependency&gt;
                  &lt;groupId&gt;org.testng&lt;/groupId&gt;
                  &lt;artifactId&gt;testng&lt;/artifactId&gt;
                  &lt;version&gt;6.14.3&lt;/version&gt;
              &lt;/dependency&gt;
          &lt;!-- Servlet API --&gt;
          &lt;dependency&gt;
            &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
            &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
            &lt;version&gt;3.1.0&lt;/version&gt;
            &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
          &lt;groupId&gt;javax.mail&lt;/groupId&gt;
          &lt;artifactId&gt;mail&lt;/artifactId&gt;
          &lt;version&gt;1.4&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-codec&lt;/groupId&gt;
          &lt;artifactId&gt;commons-codec&lt;/artifactId&gt;
          &lt;version&gt;1.5&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/javax.inject/javax.inject --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.inject&lt;/groupId&gt;
          &lt;artifactId&gt;javax.inject&lt;/artifactId&gt;
          &lt;version&gt;1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/javax.validation/validation-api --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.validation&lt;/groupId&gt;
          &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
          &lt;version&gt;1.0.0.GA&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/javax.json/javax.json-api --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.json&lt;/groupId&gt;
          &lt;artifactId&gt;javax.json-api&lt;/artifactId&gt;
          &lt;version&gt;1.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api --&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&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.jboss.interceptor/jboss-interceptor-api --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.interceptor&lt;/groupId&gt;
          &lt;artifactId&gt;jboss-interceptor-api&lt;/artifactId&gt;
          &lt;version&gt;1.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/xerces/xercesImpl --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;xerces&lt;/groupId&gt;
          &lt;artifactId&gt;xercesImpl&lt;/artifactId&gt;
          &lt;version&gt;2.8.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-fileupload&lt;/groupId&gt;
          &lt;artifactId&gt;commons-fileupload&lt;/artifactId&gt;
          &lt;version&gt;1.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations --&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;2.9.5&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/com.fasterxml/jackson-xml-databind --&gt;
      &lt;!-- https://mvnrepository.com/artifact/io.swagger/swagger-models --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;io.swagger&lt;/groupId&gt;
          &lt;artifactId&gt;swagger-models&lt;/artifactId&gt;
          &lt;version&gt;1.5.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/io.swagger/swagger-annotations --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;io.swagger&lt;/groupId&gt;
          &lt;artifactId&gt;swagger-annotations&lt;/artifactId&gt;
          &lt;version&gt;1.5.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/io.swagger/swagger-jaxrs --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;io.swagger&lt;/groupId&gt;
          &lt;artifactId&gt;swagger-jaxrs&lt;/artifactId&gt;
          &lt;version&gt;1.5.13&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/io.swagger/swagger-core --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;io.swagger&lt;/groupId&gt;
          &lt;artifactId&gt;swagger-core&lt;/artifactId&gt;
          &lt;version&gt;1.5.20&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
                  &lt;artifactId&gt;jsr311-api&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-media-multipart&lt;/artifactId&gt;
          &lt;version&gt;2.25&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client --&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;2.25&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-server --&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;2.25&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.glassfish.jersey.containers/jersey-container-servlet-core --&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;2.25&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.glassfish.jersey.containers/jersey-container-servlet --&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;2.25&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc --&gt;
      &lt;dependency&gt;
      &lt;groupId&gt;com.microsoft.sqlserver&lt;/groupId&gt;
      &lt;artifactId&gt;mssql-jdbc&lt;/artifactId&gt;
      &lt;version&gt;6.4.0.jre8&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/net.sourceforge.jtds/jtds --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;net.sourceforge.jtds&lt;/groupId&gt;
          &lt;artifactId&gt;jtds&lt;/artifactId&gt;
          &lt;version&gt;1.3.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.glassfish.jersey.media/jersey-media-json --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-media-json&lt;/artifactId&gt;
          &lt;version&gt;2.0-m05&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.glassfish.jersey.media/jersey-media-json-jackson --&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;2.26&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;!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider --&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;2.9.5&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.jaxrs/jackson-jaxrs-base --&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;2.9.5&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.dataformat&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-dataformat-yaml&lt;/artifactId&gt;
          &lt;version&gt;2.9.5&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.dataformat&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-dataformat-xml&lt;/artifactId&gt;
          &lt;version&gt;2.9.5&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-joda --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.datatype&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-datatype-joda&lt;/artifactId&gt;
          &lt;version&gt;2.9.5&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.eclipse/yasson --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.eclipse&lt;/groupId&gt;
          &lt;artifactId&gt;yasson&lt;/artifactId&gt;
          &lt;version&gt;1.0&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  
    &lt;build&gt;
      &lt;finalName&gt;BAE_4_4&lt;/finalName&gt;
      &lt;sourceDirectory&gt;src\main\java&lt;/sourceDirectory&gt;
      &lt;testSourceDirectory&gt;src/test&lt;/testSourceDirectory&gt;
      &lt;resources&gt;
        &lt;resource&gt;
          &lt;directory&gt;src&lt;/directory&gt;
          &lt;excludes&gt;
            &lt;exclude&gt;**/*.java&lt;/exclude&gt;
            &lt;exclude&gt;main/**&lt;/exclude&gt;
            &lt;exclude&gt;test/**&lt;/exclude&gt;
          &lt;/excludes&gt;
        &lt;/resource&gt;
      &lt;/resources&gt;
      
      &lt;plugins&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;version&gt;3.5.1&lt;/version&gt;
          &lt;configuration&gt;
            &lt;source&gt;1.8&lt;/source&gt;
            &lt;target&gt;1.8&lt;/target&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
            &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.14.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;!-- Suite testng xml file to consider for test execution --&gt;
                      &lt;suiteXmlFiles&gt;
                          &lt;suiteXmlFile&gt;testng.xml&lt;/suiteXmlFile&gt;
                      &lt;/suiteXmlFiles&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
        &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-eclipse-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.9&lt;/version&gt;
              &lt;configuration&gt;
                      &lt;!-- Always download and attach dependencies source code --&gt;
                  &lt;downloadSources&gt;true&lt;/downloadSources&gt;
                  &lt;downloadJavadocs&gt;false&lt;/downloadJavadocs&gt;
                  &lt;!-- Avoid type mvn eclipse:eclipse -Dwtpversion=2.0 --&gt;
                  &lt;wtpversion&gt;2.0&lt;/wtpversion&gt;
              &lt;/configuration&gt;
            &lt;/plugin&gt;
              
            &lt;!-- For Maven Tomcat Plugin --&gt;
            &lt;plugin&gt;
              &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
              &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.2&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;path&gt;/BAE&lt;/path&gt;
              &lt;/configuration&gt;
            &lt;/plugin&gt;
      &lt;/plugins&gt;
    &lt;/build&gt;
  
    &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;/project&gt;
  </code></pre>
  <p>Above are all dependencies jar files which I used in Tomcat 8 and Java 8.</p>
  <p>Can anyone suggest me what is the cause and solution for this issue?</p>