2012-08-07 43 views
0

我已經在ROOT和管理上下文上安裝了應用程序。這兩個應用程序都是在Spring Framework 3.1.2和Maven結構體上創建的。當我嘗試運行應用程序時,出現錯誤:在Tomcat上安裝基於Spring的應用程序

Aug 7, 2012 5:20:54 PM org.apache.catalina.core.StandardContext loadOnStartup 
SEVERE: Servlet threw load() exception 
java.lang.ClassNotFoundException: org.springframework.web.context.support.StandardServletEnvironment 
    (...) 
INFO: Initializing Spring root WebApplicationContext 
Aug 7, 2012 5:21:08 PM org.apache.catalina.core.StandardContext filterStart 
SEVERE: Exception starting filter springSecurityFilterChain 
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:529) 
    (...) 

我的classpath中有spring-web。我的web.xml

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    version="2.5"> 
    <context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>classpath:root-context.xml</param-value> 
    </context-param> 
    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 
    <listener> 
     <listener-class> 
      org.springframework.web.context.request.RequestContextListener 
     </listener-class> 
    </listener> 
    <filter> 
     <filter-name>sitemesh</filter-name> 
     <filter-class>org.sitemesh.config.ConfigurableSiteMeshFilter</filter-class> 
    </filter> 
    <filter-mapping> 
     <filter-name>sitemesh</filter-name> 
     <url-pattern>/*</url-pattern> 
     <dispatcher>FORWARD</dispatcher> 
     <dispatcher>REQUEST</dispatcher> 
    </filter-mapping> 
    <filter> 
     <filter-name>SetCharacterEncodingFilter</filter-name> 
     <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 
     <init-param> 
      <param-name>encoding</param-name> 
      <param-value>UTF8</param-value> 
     </init-param> 
     <init-param> 
      <param-name>forceEncoding</param-name> 
      <param-value>true</param-value> 
     </init-param> 
    </filter> 
    <filter-mapping> 
     <filter-name>SetCharacterEncodingFilter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 
    <filter> 
     <filter-name>hibernateFilter</filter-name> 
     <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class> 
    </filter> 
    <filter-mapping> 
     <filter-name>hibernateFilter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 
    <servlet> 
     <servlet-name>appServlet</servlet-name> 
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
     <init-param> 
      <param-name>contextConfigLocation</param-name> 
      <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value> 
     </init-param> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 
    <servlet-mapping> 
     <servlet-name>appServlet</servlet-name> 
     <url-pattern>/</url-pattern> 
    </servlet-mapping> 
    <error-page> 
     <error-code>404</error-code> 
     <location>/error/404.html</location> 
    </error-page> 
    <error-page> 
     <error-code>500</error-code> 
     <location>/error/500.html</location> 
    </error-page> 
    <session-config> 
     <session-timeout>30</session-timeout> 
    </session-config> 
</web-app> 

我該如何解決這個問題?

回答

1

在您的應用程序上下文中(或通過註釋),您沒有使用名稱springSecurityFilterChain定義的bean。

+0

我從來沒有聽說過bean中定義的springSecurityFilterChain。你能告訴我我該怎麼做? – Raknel 2012-08-07 18:24:53

+0

你將在春季讀過。春天的豆子就像學習春天的第一步。任何在線教程都會討論它們。 – thatidiotguy 2012-08-07 18:35:05

+0

當然。但springSecurityFilterChain是Spring上下文的默認bean,所以我不應該定義他。我想真正的問題是org.springframework.web.context.support.StandardServletEnvironment,但我找不到有關它的信息。 – Raknel 2012-08-07 18:40:56

相關問題