0

我正在尝试在 Tomcat 6.0 中部署 Resteasy webservice 应用程序,但它在 catalina.out 中给了我错误

    INFO [main] (Log4jLogger.java:82) - Adding scanned resource: com.xxxxx.xxxxx.xxxx.xxxxxx
    DEBUG [main] (Log4jLogger.java:60) - Unable to retrieve ServletContext: expandEntityReferences defaults to true
    DEBUG [main] (Log4jLogger.java:60) - Unable to retrieve ServletContext: expandEntityReferences defaults to true
    Feb 22, 2013 12:24:22 AM org.apache.catalina.core.StandardContext start
    SEVERE: Error listenerStart
    Feb 22, 2013 12:24:22 AM org.apache.catalina.core.StandardContext start
    SEVERE: Context [/xxxxxx-0.0.1-SNAPSHOT] startup failed due to previous errors

我的 web.xml 是

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>resteasy</display-name>
<session-config>
    <session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>
<context-param>
  <param-name>resteasy.scan</param-name>
  <param-value>true</param-value>
</context-param>
<context-param>
  <param-name>resteasy.document.expand.entity.references</param-name>
  <param-value>false</param-value>
</context-param>
<listener>
  <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<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>/*</url-pattern>
</servlet-mapping>
</web-app>

这里可能出了什么问题?

引发此错误的 Resteasy 代码是https://github.com/ronsigal/Resteasy/blob/1ddd469a1ddcf51796f1926477903915e41e94b8/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/plugins/中的第 47-61 行提供者/DocumentProvider.java

4

1 回答 1

0

实际上,此错误与DocumentProvider. 我检查了 localhost.log,它缺少一个我忘记复制的slf4j-api.jar,而 RESTEasy 对此有所抱怨。

故事的寓意——当你遇到这种错误时,不要忘记检查 localhost.log。

于 2013-02-22T16:56:34.677 回答