Jersey REST异常/使用JDK 1.8,java.lang.IncompatibleClassChangeError将asm-3.1.jar升级到asm-5.1.jar和asm-7.1.jar:实现类

时间:2019-07-01 12:50:13

标签: java jersey

当前使用Jersey 1.0.3.1通过JDK1.7构建RESTful服务。哪个工作正常。

当我将JDK 1.7升级到JDK1.8时。正在获取异常:

  

java.lang.ArrayIndexOutOfBoundsException:71315。

根据建议,升级与JDK1.8兼容的asm-3.1.jar最新的asm-5.x.jar版本。此后出现以下异常:

  

严重:Web应用程序[/ root]中的Servlet [JAX-RS Servlet]抛出load()异常   java.lang.IncompatibleClassChangeError:实现类。

jar文件的当前版本如下:

activation-1.1.jar
asm-3.1.jar
commons-dbutils-1.3.jar
commons-lang-2.4.jar
flexjson-2.1.jar
itextpdf-5.4.2.jar
jaxb-api-2.1.jar
jaxb-impl-2.1.10.jar
jersey-core-1.0.3.1.jar
jersey-json-1.0.3.1.jar
jersey-server-1.0.3.1.jar
jsr311-api-1.0.jar
log4j-1.2.15.jar
mysql-connector-java-5.1.6-bin.jar
ojdbc6.jar
postgresql-42.1.1.jre7.jar
stax-api-1.0-2.jar
ucp.jar

jar文件的最新版本已由stackoverflow用户建议:

activation-1.1.jar
asm-7.1.jar
commons-dbutils-1.3.jar
commons-lang-2.4.jar
flexjson-2.1.jar
itextpdf-5.4.2.jar
jaxb-api-2.1.jar
jaxb-impl-2.1.10.jar
jersey-core-1.17.1.jar
jersey-json-1.17.1.jar
jersey-server-1.17.1.jar
jsr311-api-1.0.jar
log4j-1.2.15.jar
mysql-connector-java-5.1.6-bin.jar
ojdbc6.jar
postgresql-42.1.1.jre7.jar
stax-api-1.0-2.jar
ucp.jar
jersey-container-servlet-core-2.24.jar

下面的异常堆栈跟踪。

SEVERE: Servlet [JAX-RS Servlet] in web application [/root] threw load() exception
java.lang.IncompatibleClassChangeError: Implementing class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2283)
    at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:811)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1260)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
    at com.sun.jersey.api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:112)
    at com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:78)
    at com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:89)
    at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:543)
    at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:521)
    at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:167)
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:281)
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:442)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:989)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4931)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5241)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1141)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

请帮助我摆脱这个问题,谢谢。

0 个答案:

没有答案