我正在使用Spring 4,Resteasy 3.0.6和Tomcat 7
Tomcat启动正常但我获得了所有REST端点的404。
我想我正在遇到这里描述的: https://issues.jboss.org/browse/RESTEASY-1012
我创建了该自定义类并更新了web.xml
<listener>
<listener-class>com.example.CustomContextLoaderListener</listener-class>
</listener>
但是现在我得到了这个异常并且Tomcat无法启动
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException:
Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].Stand
ardContext[]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
va:1123)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java
:800)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.
java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.
java:1549)
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)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [St
andardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 6 more
Caused by: java.lang.ClassCastException: org.springframework.web.SpringServletCo
ntainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer
at org.apache.catalina.startup.ContextConfig.getServletContainerInitiali
zer(ContextConfig.java:1661)
at org.apache.catalina.startup.ContextConfig.processServletContainerInit
ializers(ContextConfig.java:1569)
任何帮助将不胜感激。感谢
答案 0 :(得分:0)
回答我自己的问题。问题是javax-servlet是一个编译依赖项,因此我不得不将其范围更改为提供,因为它导致与Tomcat发生冲突(我正在使用Maven)