web.xml<!-- 应用程序上下文路径 -->
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:META-INF/applicationContext.xml</param-value>
</context-param><!--Spring ApplicationContext 载入 -->
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

解决方案 »

  1.   

    我把代码放到web.xml下,classpath路径改为applicationcontext所在的路径,运行tomcat时为什么提示严重: Error listenerStart
    2008-2-28 9:24:57 org.apache.catalina.core.StandardContext start
    严重: Context [/s] startup failed due to previous errors
      

  2.   

    启动tomcat时就出现上面的问题了,根本就运行不了,所以也就没有错误信息了.
      

  3.   

    我贴一个web.xml,你参照下配置下你自己的。<?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <!-- Spring ApplicationContext配置文件的路径 -->
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:META-INF/applicationContext.xml</param-value>
    </context-param>
    <!-- Character Encoding filter -->
    <filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
    <param-name>encoding</param-name>
    <param-value>UTF-8</param-value>
    </init-param>
    </filter>
    <!--Hibernate Open Session in View Filter-->
    <filter>
    <filter-name>hibernateFilter</filter-name>
    <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>*.do</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>hibernateFilter</filter-name>
    <url-pattern>*.do</url-pattern>
    </filter-mapping> <!--Spring ApplicationContext -->
    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener> <!-- Spring Introspector -->
    <listener>
    <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
    </listener> <!-- Struts Action Mapping-->
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
    <param-name>config</param-name>
    <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet> <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    <!-- session timeout -->
    <session-config>
    <session-timeout>10</session-timeout>
    </session-config>
    <!-- Index Page -->
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    <!-- Error Page -->
    <error-page>
    <error-code>500</error-code>
    <location>/page/error.jsp</location>
    </error-page>
    <error-page>
    <error-code>404</error-code>
    <location>/page/404.jsp</location>
    </error-page>
    <error-page>
    <error-code>403</error-code>
    <location>/page/403.jsp</location>
    </error-page>
    </web-app>
      

  4.   

    tomcat的版本不一样,对listener的配法不一样。pizzame 的配发是针对tomcat5.5以上版本的。