CXF3.0.1与Tomcat异常解决

在CXF框架和Tomcat一起使用的时候报了如下异常

java.io.IOException: java.lang.ClassCastException: Cannot cast org.springframework.web.SpringServletContainerInitializer to javax.servlet.ServletContainerInitializer
 at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:185)
 at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:151)
 at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1597)
 at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1125)
 at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:768)
 at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:303)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
 at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5058)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:697)
 at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1134)
 at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1780)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
 at java.util.concurrent.FutureTask.run(FutureTask.java:262)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:744)

 

网上查了很久也没有看到解决办法,可能是我使用最新版本的原因。查了很久找到了原因所在,jar包问题

解决办法如下:

移除Jetty依赖包geronimo-servlet_3.0_spec-1.0.jar

你可能感兴趣的:(webservice,CXF)