项目中使用Spring时配置web.xml的listener侦听接口不能初始化的问题 用Spring+Hibernate框架做项目,配置就有问题,是web.xml配置的spring侦听器的问题。 程序错误信息为: 2007-3-4 0:31:22 org.apache.catalina.core.StandardContext start 严重: Error listenerStart 2007-3-4 0:31:22 org.apache.catalina.core.StandardContext start 严重: Context [/Salvation] startup failed due to previous errors
struts-config.xml的配置部分为:
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
</plug-in>
applicationContext.xml的配置部分为:
<bean name="/login" class="com.test.struts.action.LoginAction" singleton="false">
<property name="userDAO">
<ref bean="userDAOProxy" />
</property>
</bean>
web.xml部分配置如下:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class> org.springframework.web.context.ContextLoaderListener </listener-class>
</listener>
解决方法为:
<listener>
<listener-class> org.springframework.web.context.ContextLoaderListener </listener-class>
</listener>
改成:
<servlet>
<servlet-name>SpringContextServlet</servlet-name>
<servlet-class> org.springframework.web.context.ContextLoaderServlet </servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
原因可能是tomcat版本的问题。