Announcement Announcement Module
Collapse
No announcement yet.
No bean named 'springSecurityFilterChain' is defined Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • No bean named 'springSecurityFilterChain' is defined

    Hello again folks..I am having a problem and I hope I can at least get an answer here because, I haven't in the past.
    The error that I am experiencing is this:

    Sep 06, 2012 10:32:11 AM org.apache.catalina.core.AprLifecycleListener init
    INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.7.0_05\bin;C:\Windows\Sun\Java\bin ;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\CollabNet\Subversion Client;C:\Windows\system32;C:\Windows;C:\Windows\S ystem32\Wbem;C:\Windows\System32\WindowsPowerShell \v1.0\;C:\Program Files\Dell\DW WLAN Card;C:\Program Files\Java\jdk1.7.0_05\bin;C:\Groovy-1.7.10\bin;C:\grails-2.1.0\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\TortoiseSVN\bin;.
    Sep 06, 2012 10:32:12 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:EmployeeGrowthTracker' did not find a matching property.
    Sep 06, 2012 10:32:12 AM org.apache.coyote.AbstractProtocolHandler init
    INFO: Initializing ProtocolHandler ["http-bio-8089"]
    Sep 06, 2012 10:32:13 AM org.apache.coyote.AbstractProtocolHandler init
    INFO: Initializing ProtocolHandler ["ajp-bio-8010"]
    Sep 06, 2012 10:32:13 AM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 3895 ms
    Sep 06, 2012 10:32:13 AM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Catalina
    Sep 06, 2012 10:32:13 AM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.12
    Sep 06, 2012 10:32:14 AM org.apache.catalina.util.SessionIdGenerator createSecureRandom
    INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [228] milliseconds.
    Sep 06, 2012 10:32:19 AM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring root WebApplicationContext
    INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
    INFO : org.springframework.web.context.support.XmlWebAppl icationContext - Refreshing Root WebApplicationContext: startup date [Thu Sep 06 10:32:19 BOT 2012]; root of context hierarchy
    INFO : org.springframework.beans.factory.xml.XmlBeanDefin itionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/root-context.xml]
    INFO : org.springframework.beans.factory.support.DefaultL istableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@2e8b3bdd: defining beans []; root of factory hierarchy
    INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 1980 ms
    Sep 06, 2012 10:32:21 AM org.apache.catalina.core.StandardContext filterStart
    SEVERE: Exception starting filter springSecurityFilterChain
    org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'springSecurityFilterChain' is defined
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeanDefinition(DefaultListab leBeanFactory.java:529)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getMergedLocalBeanDefinition(AbstractB eanFactory.java:1095)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:277 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.context.support.AbstractApplic ationContext.getBean(AbstractApplicationContext.ja va:1097)
    at org.springframework.web.filter.DelegatingFilterPro xy.initDelegate(DelegatingFilterProxy.java:326)
    at org.springframework.web.filter.DelegatingFilterPro xy.initFilterBean(DelegatingFilterProxy.java:236)
    at org.springframework.web.filter.GenericFilterBean.i nit(GenericFilterBean.java:194)
    at org.apache.catalina.core.ApplicationFilterConfig.i nitFilter(ApplicationFilterConfig.java:273)
    at org.apache.catalina.core.ApplicationFilterConfig.g etFilter(ApplicationFilterConfig.java:254)
    at org.apache.catalina.core.ApplicationFilterConfig.s etFilterDef(ApplicationFilterConfig.java:372)
    at org.apache.catalina.core.ApplicationFilterConfig.< init>(ApplicationFilterConfig.java:98)
    at org.apache.catalina.core.StandardContext.filterSta rt(StandardContext.java:4562)
    at org.apache.catalina.core.StandardContext$2.call(St andardContext.java:5240)
    at org.apache.catalina.core.StandardContext$2.call(St andardContext.java:5235)
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)

    Sep 06, 2012 10:32:21 AM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Error filterStart
    Sep 06, 2012 10:32:21 AM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Context [/employeegrowthtracker] startup failed due to previous errors
    Sep 06, 2012 10:32:21 AM org.apache.catalina.core.ApplicationContext log
    INFO: Closing Spring root WebApplicationContext
    INFO : org.springframework.web.context.support.XmlWebAppl icationContext - Closing Root WebApplicationContext: startup date [Thu Sep 06 10:32:19 BOT 2012]; root of context hierarchy
    INFO : org.springframework.beans.factory.support.DefaultL istableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@2e8b3bdd: defining beans []; root of factory hierarchy
    Sep 06, 2012 10:32:21 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
    SEVERE: The web application [/employeegrowthtracker] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
    Sep 06, 2012 10:32:21 AM org.apache.coyote.AbstractProtocolHandler start
    INFO: Starting ProtocolHandler ["http-bio-8089"]
    Sep 06, 2012 10:32:21 AM org.apache.coyote.AbstractProtocolHandler start
    INFO: Starting ProtocolHandler ["ajp-bio-8010"]
    Sep 06, 2012 10:32:21 AM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 8695 ms


    And web.xml is this:
    <?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">

    <!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/spring/root-context.xml</param-value>
    </context-param>

    <!-- Processes application requests -->
    <!-- <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-->


    <!-- Creates the Spring Container shared by all Servlets and Filters -->
    <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListe ner
    </listener-class>
    </listener>
    <servlet>
    <servlet-name>appServlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</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>
    <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>
    </web-app>


    Any help will be appreciated. Thx.

  • #2
    My applicaiton XML

    See attach application .xml
    Attachment
    Attached Files

    Comment


    • #3
      Originally posted by deanclarke View Post
      <!-- Creates the Spring Container shared by all Servlets and Filters -->
      <servlet>
      <servlet-name>appServlet</servlet-name>
      <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</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>
      <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>
      Not sure if it matters, but I believe the filter definition should be placed before the servlet definition.

      Comment


      • #4
        Originally posted by deanclarke View Post
        Hello again folks..I am having a problem and I hope I can at least get an answer here because, I haven't in the past.
        You posted a reply to your own post, didn't you? Anyway whatever you are doing wrong is probably not really an OAuth problem, so you might get more help in the Spring Security or Spring MVC forums. You latest error and web.xml seem to say simply that you do not have a springSecurityFilterChain defined in your root-context.xml. Does it contain an <http/> element (that's the filter chain)?

        Comment


        • #5
          No it doesn't. The <http /> tag elements are in the application context's xml. Looking at the sparklr example available for oauth, there isn't a root-context.xml...so my root.xml is just blank at the moment. See below application context:

          <?xml version="1.0" encoding="UTF-8"?>
          <beans:beans xmlns="http://www.springframework.org/schema/security"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:beans="http://www.springframework.org/schema/beans"
          xsi:schemaLocation="
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schem...ring-beans.xsd
          http://www.springframework.org/schema/security
          http://www.springframework.org/schema/security/spring-security-3.1.xsd">
          <!--

          <http auto-config="true" use-expressions="false">
          <intercept-url pattern="/*" access="ROLE_USER"/>
          <intercept-url pattern="/authenticate/*" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
          <form-login login-page="/authenticate/login" login-processing-url="/authenticate/auth" authentication-failure-url="/authenticate/login-error" />
          </http>

          <authentication-manager alias="authenticationManager">
          <authentication-provider>
          <user-service>
          <user authorities="ROLE_USER" name="guest" password="guest"/>
          </user-service>
          </authentication-provider>
          </authentication-manager>
          -->
          </beans:beans>

          Comment


          • #6
            Originally posted by jrod View Post
            Not sure if it matters, but I believe the filter definition should be placed before the servlet definition.
            Yeah I tried that but, same problem :S.

            Comment


            • #7
              If you change the location of the filter chain from the default (as in sparklr samples) you have to tell the filter where to find it. Hence this section in sparklr web.xml:

              Code:
              	<filter>
              		<filter-name>springSecurityFilterChain</filter-name>
              		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
              		<init-param>
              			<param-name>contextAttribute</param-name>
              			<param-value>org.springframework.web.servlet.FrameworkServlet.CONTEXT.spring</param-value>
              		</init-param>
              	</filter>
              Your servlet is "appServlet" (not "spring") so you need to make the corresponding change, but you can't just omit that parameter.

              If your root context is blank, why not remove it? Or else move your filter chain in there and use the default filter settings.

              Comment

              Working...
              X