问题描述
- 没有C币,第一次提问,这个问题困扰很久了,请大神帮忙协助解决,谢谢!
-
单独建立项目同样的配置不会出现这个问题,与spring mvc+mybatis框放在一起就会报这个错。<servlet> <servlet-name>Rest Servlet</servlet-name> <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class> <load-on-startup>1</load-on-startup> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>com.nx.server.rest</param-value> </init-param>
Rest Servlet
/api/*
javax.servlet.ServletException: Servlet.init() for servlet Rest Servlet threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
root causejava.lang.IncompatibleClassChangeError: Implementing class
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(Unknown Source)
java.security.SecureClassLoader.defineClass(Unknown Source)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2895)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:79)
com.sun.jersey.api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:104)
com.sun.jersey.api.core.PackagesResourceConfig.(PackagesResourceConfig.java:78)
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:373)
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556)
javax.servlet.GenericServlet.init(GenericServlet.java:160)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)![图片说明](http://img.ask.csdn.net/upload/201507/17/1437096748_574973.png)
解决方案
jar包有重复导致冲突了。检查一下部署的地方是不是有相同的jar包,如有的话,去掉重复的。
解决方案二:
用的是maven就看看你的pom是不是有重复的包,没用就看lib里面
解决方案三:
http://blog.csdn.net/evankaka/article/details/45790533
Spring+SpringMVC+Mybatis+Mysql整合实例
解决方案四:
@lhl_lqc
就是找不到相同的jar包,单独建立项目跑就没有问题,跟已有的spring mvc + mybatis 框架放在一起就出现冲突,搞醉了。
解决方案五:
@Unkown_Answer Unkown_Answer
lib下引用的所有jar包文件都已经截图
http://img.ask.csdn.net/upload/201507/17/1437096748_574973.png
可以排除跟tomcat里lib下jar包冲突的问题,我单独新建项目没有问题。
用的开发工具是 myeclipse