本文介绍了java.lang.IncompatibleClassChangeError:实现类部署到应用程序引擎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我在JRE 1.6上使用Jersey 1.13编写了几个REST服务。本地运行良好,但在部署到GAE后,出现此错误: ****从servlet $ b未捕获异常$ b java.lang.IncompatibleClassChangeError:在java.lang.ClassLoader.defineClass1在实现类 com.google.appengine.runtime.Request.process-139e1bda14d5aebc(Request.java)(本机方法)$在java.lang.ClassLoader.defineClass中的b $ b(ClassLoader.java:634)在java.security.SecureClassLoader.defineClass中的(SecureClassLoader.java:142)在java.net.URLClassLoader.defineClass上的( $ java.util中的。 at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang。方法.invoke(Method.java:616)$ java.util.ClassLoader.loadClass上的(ClassLoader.java:266) at com.sun.jersey.api.core.ScanningResourceConfig.init( ScanningResourceConfig.java:79)在com.sun.jersey.api。 core.PackagesResourceConfig.init(PackagesResourceConfig.java:104) at com.sun.jersey.api.core.PackagesResourceConfig。< init>(PackagesResourceConfig.java:78) at com.sun.jersey .api.core.PackagesResourceConfig<初始化>(PackagesResourceConfig.java:89)。在com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:700)。在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)b $ b。在com.sun.jersey.spi.container.servlet.ServletContainer.init (ServletContainer.java :557) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440) at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHo lder.java:263)在org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)在org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685 ) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)在org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)在org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)在org.mortbay .component.AbstractLifeCycle.start(AbstractLifeCycle.java:50),位于com.google.tracing.TraceContext $ TraceContextRunnable.runInContext(TraceContext.java:452),位于com.google.tracing.TraceContext $ TraceContextRunnable $ 1.run(TraceContext.java:458) at com.google.tracing.TraceContext.runInContext(TraceContext.java:698) at com.google.tracing.TraceContext $ AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext。 Ĵ ava:336) at com.google.tracing.TraceContext $ AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:328) at com.google.tracing.TraceContext $ TraceContextRunnable.run(TraceContext.java:456) at java.lang.Thread.run(Thread.java:679)**** 解决方案这个异常是由asm-4.0.jar和asm-3.1之间的兼容性问题引起的。罐。使用新版本的AppEngine,使用了asm-4.0.jar,并且它与依赖于asm-3.1.jar的Jersey不兼容。为了使泽西仍然在GAE 1.7上工作,你必须删除对asm-4.0.jar的依赖。 看到这篇文章: http://cloudvane.com/2012/09/23/problem-with -google-appengine-and-jersey-with-java / 经过测试和验证,如下所示: 将asm-3.3.1.jar添加到您的war-> lib 将它添加到您的re build path中 删除asm-4.0.jar 项目 - >属性 - > Google - > AppEngine:将Datanuclueus切换为v1 ol> 这就是它! I wrote a couple of REST services using Jersey 1.13 on JRE 1.6. Everything runs fine locally, but after I deploy to GAE I get this error:****Uncaught exception from servletjava.lang.IncompatibleClassChangeError: Implementing class at com.google.appengine.runtime.Request.process-139e1bda14d5aebc(Request.java) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:634) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:277) at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:79) at com.sun.jersey.api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:104) 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:700) at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:678) at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:203) at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:374) at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:557) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440) at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:452) at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:458) at com.google.tracing.TraceContext.runInContext(TraceContext.java:698) at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:336) at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:328) at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:456) at java.lang.Thread.run(Thread.java:679)****Any help would be appreciated. 解决方案 This exception is caused by compatibility issues between asm-4.0.jar and asm-3.1.jar. With the new Version of AppEngine, asm-4.0.jar is used and it is not compatible with Jersey, which relies on asm-3.1.jar. To make Jersey still work on GAE 1.7, you have to remove the dependency on asm-4.0.jar.See this post : http://cloudvane.com/2012/09/23/problem-with-google-appengine-and-jersey-with-java/It s tested and verified, like that:add asm-3.3.1.jar to your war->libadd it to you re build pathremove physically the asm-4.0.jarProject -> Properties -> Google -> AppEngine: switch Datanuclueus to v1That s it! 这篇关于java.lang.IncompatibleClassChangeError:实现类部署到应用程序引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-30 07:31