Tomcat 7.0.30不适用于Resteasy 2.3.4

时间:2012-09-11 13:55:03

标签: java tomcat7 resteasy

我使用resteasy 2.3.4 Final创建了一个小型Web应用程序,并将其部署到Tomcat 7.0.30。我在tomcat启动时收到以下错误消息:

...
INFO: JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.
Sep 11, 2012 9:28:08 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter org.jboss.resteasy.plugins.server.servlet.Filter30Dispatcher
java.lang.NoClassDefFoundError: javax/enterprise/context/spi/Contextual
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
...

我的web.xml如下:

<context-param>
    <param-name>resteasy.servlet.mapping.prefix</param-name>
    <param-value>/services</param-value>
</context-param>

<context-param>
    <param-name>resteasy.scan.resources</param-name>
    <param-value>true</param-value>
</context-param>

<servlet>
    <servlet-name>Resteasy</servlet-name>
    <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>Resteasy</servlet-name>
    <url-pattern>/services/*</url-pattern>
</servlet-mapping>

2 个答案:

答案 0 :(得分:6)

通过删除resteasy-cdi-2.3.4.Final.jar解决了问题。

答案 1 :(得分:2)

发生在我身上,但是使用了tomcat 7.0.52和resteasy-cdi-3.0.6.Final   我从库包中删除了resteasy-cdi-3.0.6.Final,并且部署得很好