2014-03-30 1 views
-1

이 내 web.xml 파일DelegatingFilterProxy 필터는 발견

<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> 


ERROR - SEVERE: Exception starting filter springSecurityFilterChain 
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named          'springSecurityFilterChain' is defined      

NO IDEA에서 조각입니다 호출되지 않습니다 -이 불려 오지 않는 이유.

+1

당신이 포함하고있는 봄 구성 파일과 함께 사용하고있는 전체 web.xml을 제공 할 수 있습니까? – geoand

+0

이메일 ID를 공유해 주시겠습니까? 스택 오버플로에서 공유하기가 어려울 것으로 생각됩니다. 감사. –

+0

아마도 다른 사용자가 그것을 볼 수 있도록 붙여 넣기에 넣는 것이 더 좋을 것입니다. – geoand

답변

0
WEB.XML -  

    <context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>/WEB-INF/spring/root-context.xml</param-value> 
    </context-param> 

    <!-- Creates the Spring Container shared by all Servlets and Filters --> 
    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 

    <!-- Processes application requests --> 
    <servlet> 
     <servlet-name>login</servlet-name> 
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
     <init-param> 
      <param-name>contextConfigLocation</param-name> 
      <param-value> 
       /WEB-INF/spring/appServlet/login-security.xml 
       /WEB-INF/spring/appServlet/login-servlet.xml 
       /WEB-INF/spring/appServlet/login-service.xml 
      </param-value> 
     </init-param> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>login</servlet-name> 
     <url-pattern>/</url-pattern> 
    </servlet-mapping> 

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

    <filter-mapping> 
     <filter-name>springSecurityFilter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 
    <welcome-file-list> 
     <welcome-file>login.jsp</welcome-file> 
    </welcome-file-list> 


LOGIN-SECURITY.xml 

<beans:import resource="login-service.xml"/> 
    <security:http auto-config="true"> 
     <security:intercept-url pattern='/home*' 
      access='ROLE_USER,ROLE_ADMIN' /> 
     <security:intercept-url pattern='/admin*' 
      access='ROLE_ADMIN' /> 
     <security:form-login login-page='/login.jsp' 
      default-target-url='/home' authentication-failure-url='/login.jsp?error=true' /> 
     <security:logout logout-success-url='/login.jsp' /> 
     <security:anonymous username='guest' 
      granted-authority='ROLE_GUEST' /> 
     <security:remember-me /> 
    </security:http> 

    <security:authentication-manager> 
     <security:authentication-provider> 

      <security:jdbc-user-service 
       data-source-ref='myDataSource' 
       users-by-username-query="select username, password, 'true' as enabled from USER_DETAILS where username=?" 
       authorities-by-username-query="select USER_DETAILS.username , USER_AUTH.AUTHORITY as authorities from USER_DETAILS,USER_AUTH 
       where USER_DETAILS.username = ? AND USER_DETAILS.username=USER_AUTH.USERNAME"></security:jdbc-user-service> 

     </security:authentication-provider> 
    </security:authentication-manager> 


LOGIN-SERVICE.xml 

    <beans:property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /> 
      <beans:property name="url" value="jdbc:oracle:thin:@localhost:1521:XE" /> 
      <beans:property name="username" value="system" /> 
      <beans:property name="password" value="oracle" /> 



LOGIN-SERVLET.xml 

<context:component-scan base-package="com.poc.security" /> 

    <bean id="internalResourceResolver" 
     class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
     <property name="prefix" value="/"></property> 
     <property name="suffix" value=".jsp"></property> 
    </bean> 
    <bean 
     class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" /> 

    <bean 
     class='org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter' /> 
0

xml 파일 위치 사이에 쉼표를 추가해야 할 수도 있습니다. 체크 아웃 this 대답에 대한 자세한 내용은

+0

그런 식으로도 작동하지 않았습니다. 나는 따라 갔다 [link] http://www.baeldung.com/no-bean-named-springsecurityfilterchain-is-defined –