我有一个 Spring/Hibernate 应用程序,我已将其转换为 Web 应用程序以提供 RESTful Web 服务(使用 Jersey)。我正在尝试将 Web 应用程序部署到 Tomcat 6.0.20 上,但在日志文件中只收到一条神秘的错误消息:
Jul 8, 2009 2:25:22 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Jul 8, 2009 2:25:22 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/lmrest] startup failed due to previous errors
我已将日志记录级别设置为调试,但没有任何可疑消息显示出了什么问题,除了这个,这对我来说看起来很无害:
1360 [http-8080-1] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
我正在使用最新版本的 Spring 和 Hibernate。我在 web.xml 中使用 ContextLoaderListener。这可能是无法启动的侦听器吗?我假设它至少部分运行,因为我可以看到许多 Hibernate 配置日志消息在 Web 应用程序启动失败之前滚动过去。我的主要问题是我看不到任何错误消息,表明它抱怨的侦听器无法启动。
我正在使用的 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">
<!-- listener to pull in the Spring application context -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:appContext.xml</param-value>
</context-param>
<!-- Jersey servlet container to intercept all URIs -->
<servlet>
<servlet-name>JerseyContainer</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JerseyContainer</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
如果有人能给我一些关于在哪里寻找我的错误的想法,我会非常感激,因为我很难过。提前致谢!
- 詹姆士