2011-02-17 117 views
0

當CONFIGS被加載,我得到的錯誤名爲「springSecurityFilterChain」無豆被定義

嚴重:異常開始過濾springSecurityFilterChain org.springframework.beans.factory.NoSuchBeanDefinitionException:無豆命名爲「springSecurityFilterChain」的定義

我仲配置:

<http use-expressions="true" access-denied-page="/error/casfailed.html" entry-point-ref="headerAuthenticationEntryPoint"> 
    <intercept-url pattern="/" access="permitAll"/> 
    <!-- <intercept-url pattern="/index.html" access="permitAll"/> --> 
    <intercept-url pattern="/index.html" access="hasAnyRole('ROLE_USER')"/> 
    <intercept-url pattern="/history.html" access="hasAnyRole('ROLE_USER')"/> 
    <intercept-url pattern="/absence.html" access="hasAnyRole('ROLE_USER')"/> 
    <intercept-url pattern="/search.html" access="hasAnyRole('ROLE_USER')"/> 
    <intercept-url pattern="/employees.html" access="hasAnyRole('ROLE_USER')"/> 
    <intercept-url pattern="/employee.html" access="hasAnyRole('ROLE_USER')"/> 
    <intercept-url pattern="/contract.html" access="hasAnyRole('ROLE_USER')"/> 
    <intercept-url pattern="/myforms.html" access="hasAnyRole('HLO','OPISK')"/> 
    <intercept-url pattern="/vacationmsg.html" access="hasAnyRole('ROLE_USER')"/> 
    <intercept-url pattern="/redirect.jsp" filters="none" /> 
    <intercept-url pattern="/error/**" filters="none" /> 
    <intercept-url pattern="/layout/**" filters="none" /> 
    <intercept-url pattern="/js/**" filters="none" /> 
    <intercept-url pattern="/**" access="isAuthenticated()" /> 

    <!-- session-management invalid-session-url="/absence.html"/ --> 
    <!-- logout logout-success-url="/logout.html"/ --> 
    <custom-filter ref="ssoHeaderAuthenticationFilter" before="CAS_FILTER"/> <!-- CAS_FILTER ??? --> 
</http> 

<authentication-manager alias="authenticationManager"> 
    <authentication-provider ref="doNothingAuthenticationProvider"/> 
</authentication-manager> 

<beans:bean id="doNothingAuthenticationProvider" class="com.nixu.security.sso.web.DoNothingAuthenticationProvider"/> 
<beans:bean id="ssoHeaderAuthenticationFilter" class="com.nixu.security.sso.web.HeaderAuthenticationFilter"> 
<beans:property name="groups"> 
    <beans:map> 
     <beans:entry key="cn=lake,ou=confluence,dc=utu,dc=fi" value="ROLE_ADMIN"/> 
    </beans:map> 
</beans:property> 
</beans:bean> 
<beans:bean id="headerAuthenticationEntryPoint" 
      class="com.nixu.security.sso.web.HeaderAuthenticationEntryPoint"/> 

和web.xml

<context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value> 
    /WEB-INF/applicationContext.xml 
    /WEB-INF/sec-config.xml 
    /WEB-INF/idm-config.xml 
    /WEB-INF/ldap-config.xml 
    </param-value> 
    </context-param> 

<display-name>KeyCard</display-name> 


<context-param> 
<param-name>webAppRootKey</param-name> 
<param-value>KeyCardAppRoot</param-value> 
</context-param> 


    <context-param> 
    <param-name>log4jConfigLocation</param-name> 
    <param-value>/WEB-INF/log4j.properties</param-value> 
    </context-param> 

    <!-- Reads request input using UTF-8 encoding --> 
    <filter> 
    <filter-name>characterEncodingFilter</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> 
    <init-param> 
     <param-name>forceEncoding</param-name> 
     <param-value>true</param-value> 
    </init-param> 
    </filter> 

    <filter> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
    </filter> 

    <filter-mapping> 
    <filter-name>characterEncodingFilter</filter-name> 
    <url-pattern>/*</url-pattern> 
    </filter-mapping> 

    <filter-mapping> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <url-pattern>/*</url-pattern> 
    </filter-mapping> 

<listener> 
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 

    <listener> 
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> 
    </listener> 


    <listener> <!-- this is for session scoped objects --> 
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> 
    </listener> 

    <listener> 
    <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class> 
    </listener> 

    <!-- Handles all requests into the application --> 
    <servlet> 
    <servlet-name>KeyCard</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <load-on-startup>1</load-on-startup> 
    </servlet> 

    <servlet> 
    <servlet-name>tiles</servlet-name> 
    <servlet-class>org.apache.tiles.web.startup.TilesServlet</servlet-class> 
    <init-param> 
     <param-name> 
     org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG 
     </param-name> 
     <param-value> 
     /WEB-INF/tilesViewContext.xml 
     </param-value> 
    </init-param> 
    <load-on-startup>2</load-on-startup> 
    </servlet> 

    <servlet-mapping> 
    <servlet-name>KeyCard</servlet-name> 
    <url-pattern>*.html</url-pattern> 
    </servlet-mapping> 

    <session-config> 
    <session-timeout> 
     120 
    </session-timeout> 
    </session-config> 

    <welcome-file-list> 
    <welcome-file>index.jsp</welcome-file> 
    </welcome-file-list> 

    <!-- error-page> 
    <exception-type>java.lang.Exception</exception-type> 
    <location>/WEB-INF/error/error.jsp</location> 
    </error-page --> 

</web-app> 

怎麼了?

+0

我沒有得到你的web.xml配置。它不清楚你的問題。 – Sagar

+0

對不起,這些格式在這裏似乎不起作用。 – michaeljackson4ever

+0

你有運行時環境中的彈簧安全罐嗎? – Ritesh

回答

0

以下配置存在於您的web.xml中?

<filter> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
</filter> 

<filter-mapping> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 
+0

是的,我有那些 – michaeljackson4ever

+1

其實,錯誤的瓷磚定義錯了!除此之外,我沒有這麼做,因爲我沒有得到涉及瓦片的任何錯誤! – michaeljackson4ever

+0

好的,你解決了這個問題。 – Sagar

3

也許你錯過了bean裝載器。

應用程序的context.xml

<beans:import resource="webmvc-context.xml"/> 
<beans:import resource="webflow-context.xml"/> 
<beans:import resource="security-context.xml"/> 

的web.xml

<context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value>/WEB-INF/spring/appServlet/application-context.xml</param-value> 
</context-param> 
<listener> 
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
</listener> 
0

只是爲了將來的用戶。看起來,過濾器的名稱區分大小寫,不能更改。

請參閱this thread在春季論壇。我仍然有問題,但至少我知道過濾器的名稱不僅僅是過濾器和過濾器映射之間的參考。

相關問題