Results 1 to 3 of 3

Thread: Cannot find the action name spring_security_login

  1. #1

    Default Cannot find the action name spring_security_login

    I am using Strut2 with Tiles along with Spring security and Spring MVC. I am new to Spring Security and Spring MVC.

    I am getting the following Error:

    There is no Action mapped for namespace / and action name spring_security_login. - [unknown location]
    at com.opensymphony.xwork2.DefaultActionProxy.prepare (DefaultActionProxy.java:189)
    at org.apache.struts2.impl.StrutsActionProxy.prepare( StrutsActionProxy.java:61)
    ...

    Please see my web.xml file:

    <web-app>
    <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.Stru tsPrepareAndExecuteFilter</filter-class>
    </filter>

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

    <listener>
    <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
    </listener>

    <listener>
    <listener-class>
    org.apache.struts2.tiles.StrutsTilesListener
    </listener-class>
    </listener>
    <context-param>
    <param-name>tilesDefinitions</param-name>
    <param-value>/WEB-INF/tiles.xml</param-value>
    </context-param>

    <filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFil terProxy</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    /WEB-INF/applicationContext.xml
    /WEB-INF/applicationContext-security.xml
    </param-value>
    </context-param>

    </web-app>


    Please see my applicationContext-security.xml file

    <global-method-security pre-post-annotations="enabled">
    </global-method-security>

    <http use-expressions="true">

    <intercept-url pattern="/**" access="hasRole('ROLE_USER')" />
    <form-login />
    <logout />

    <!-- Uncomment to limit the number of sessions a user can have -->
    <session-management invalid-session-url="/timeout.jsp">
    <concurrency-control max-sessions="1" error-if-maximum-exceeded="true" />
    </session-management>
    </http>

    <authentication-manager>
    <authentication-provider>
    <password-encoder hash="plaintext"/>
    <user-service>
    <user name="admin" password="admin" authorities="ROLE_USER, ROLE_ADMIN" />
    <user name="guest" password="guest" authorities="ROLE_USER" />
    </user-service>
    </authentication-provider>
    </authentication-manager>


    What should I do to have struts.xml file or Strut2 to forward the action spring_security_login to Spring security and display the loginpage?? Any help appreciated
    Last edited by bensonthomasusa; Dec 22nd, 2010 at 07:09 PM.

  2. #2
    Join Date
    Jan 2008
    Posts
    1,826

    Default

    Spring Security should be the first filter mapping in your web.xml otherwise Struts is going to attempt to handle URLs that Spring Security normally handles.
    Rob Winch - @rob_winch
    Spring Security Lead
    Pivotal

  3. #3

    Default

    I changed the web.xml file order and I am able to see the default login page.


    <filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFil terProxy</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    /WEB-INF/applicationContext.xml
    /WEB-INF/applicationContext-security.xml
    </param-value>
    </context-param>

    <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.Stru tsPrepareAndExecuteFilter</filter-class>
    </filter>

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

    <listener>
    <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
    </listener>

    <listener>
    <listener-class>
    org.apache.struts2.tiles.StrutsTilesListener
    </listener-class>
    </listener>
    <context-param>
    <param-name>tilesDefinitions</param-name>
    <param-value>/WEB-INF/tiles.xml</param-value>
    </context-param>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •