5

我使用 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>
4

2 回答 2

6

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

于 2012-09-25T12:37:59.303 回答
2

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

于 2014-03-11T08:17:15.643 回答