10 Replies Latest reply on Feb 7, 2011 12:47 AM by sanintel3

    springSecurityFilterChain filter not loaded in JBOss 5.1 deployment

    sanintel3

      I am getting below error while deploying an application containing spring security, in JBOSS 5.1, however the same is deployed successfully in 4.2.3 version and as well in tomcat 6.x.

       

      ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/bcp]] (main) 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:387)

          at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:971)

          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246)

          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168)

          at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:884)

          at org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:216)

          at org.springframework.web.filter.DelegatingFilterProxy.initFilterBean(DelegatingFilterProxy.java:145)

          at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:179)

          at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:234)

          at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:332)

          at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:90)

          at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3783)

          at org.apache.catalina.core.StandardContext.start(StandardContext.java:4413)

          at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)

          at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)

          at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)

          at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)

          at org.jboss.web.deployers.WebModule.start(WebModule.java:97)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

          at java.lang.reflect.Method.invoke(Method.java:597)

          at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)

          at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)

          at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)

          at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)

          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)

          at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)

          at $Proxy38.start(Unknown Source)

          at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)

          at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)

          at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)

          at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)

          at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)

          at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)

          at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)

          at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)

          at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)

          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)

          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)

          at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)

          at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)

          at org.jboss.system.ServiceController.doChange(ServiceController.java:688)

          at org.jboss.system.ServiceController.start(ServiceController.java:460)

          at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)

          at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)

          at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)

          at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)

          at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)

          at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)

          at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)

          at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)

          at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)

          at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)

          at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)

          at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)

          at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)

          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)

          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)

          at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)

          at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)

          at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)

          at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)

          at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)

          at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)

          at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)

          at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)

          at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)

          at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)

          at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)

          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)

          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)

          at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)

          at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)

          at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)

          at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)

          at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)

          at org.jboss.Main.boot(Main.java:221)

          at org.jboss.Main$1.run(Main.java:556)

          at java.lang.Thread.run(Thread.java:619)

       

       

       

      Below is the web.xml configuration

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

       

      ......

       

      <listener>

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

          </listener>

       

           <listener>

               <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>

           </listener>

       

          <context-param>

              <param-name>contextConfigLocation</param-name>

              <param-value>

                  classpath*:struts-spring-plugin.xml, classpath:*spring-*.xml,

              </param-value>

          </context-param>

       

       

       

      Bleow is the configuration in spring-application-context.xml file

      <?xml version="1.0" encoding="UTF-8"?>

       

      <!--

        - Sample namespace-based configuration

        -

        - $Id: spring-security-community.xml,v 1.6 2010/11/25 15:04:46 dantis Exp $

        -->

       

      <beans:beans xmlns="http://www.springframework.org/schema/security"

          xmlns:beans="http://www.springframework.org/schema/beans"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

                              http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.1.xsd">

       

          <global-method-security secured-annotations="enabled" >

              <!-- AspectJ pointcut expression that locates our "post" method and applies security that way

              <protect-pointcut expression="execution(* bigbank.*Service.post*(..))" access="ROLE_TELLER"/>

              -->

          </global-method-security>

       

           <http auto-config="true" >

       

              <intercept-url pattern="/community/locale**" access="ROLE_ADMIN" />

              <intercept-url pattern="/base/dataType_edit.action**" access="ROLE_ADMIN" />

              <intercept-url pattern="/base/dataType_edit.action?form=Y**" access="ROLE_MANAGER" />

       

              <intercept-url pattern="/base/property**" access="ROLE_ADMIN,ROLE_MANAGER" />

       

       

              <intercept-url pattern="/base/user**" access="ROLE_ADMIN,ROLE_MANAGER,ROLE_USER" />

              <intercept-url pattern="/base/group**" access="ROLE_ADMIN,ROLE_MANAGER" />

              <intercept-url pattern="/base/template**" access="ROLE_ADMIN,ROLE_MANAGER" />

       

              <!-- <intercept-url pattern="/base/data_save.action" access="ROLE_ADMIN,ROLE_MANAGER" /> -->

       

       

              <intercept-url pattern="/community/dms.action" access="ROLE_MANAGER" />

              <intercept-url pattern="/base/link**" access="ROLE_MANAGER" />

              <intercept-url pattern="/base/data_edit**" access="ROLE_MANAGER" />

       

              <intercept-url pattern="/community/meetingCenter.action*" access="ROLE_MANAGER" />

              <intercept-url pattern="/community/meetingCenter_createMeeting*" access="ROLE_MANAGER" />

       

              <intercept-url pattern="/community/secure.action**" access="ROLE_ADMIN,ROLE_MANAGER,ROLE_USER" />

              <!--

              <intercept-url pattern="/shoppingcart/product_manageCart.action*" access="ROLE_ADMIN,ROLE_MANAGER,ROLE_USER" />

              <intercept-url pattern="/shoppingcart/product_checkOut.action*" access="ROLE_ADMIN,ROLE_MANAGER,ROLE_USER" />

              <intercept-url pattern="/shoppingcart/product_buy.action*" access="ROLE_ADMIN,ROLE_MANAGER,ROLE_USER" />

              <intercept-url pattern="/shoppingcart/product_trybeforebuy.action*" access="ROLE_ADMIN,ROLE_MANAGER,ROLE_USER" />

               -->

       

              <!--  The login-page used below is not valid since entry-point-ref is specified. authenticationEntryPoint

              bean decides the login page. -->

              <form-login login-page="/login.action"  authentication-failure-url="/login.action?err=1"

                  always-use-default-target="false"       

                  default-target-url="/community/home.action" login-processing-url="/saml/SSO" />

       

              <anonymous />

              <logout  invalidate-session="true" logout-success-url="/community/home.action"/>

              <remember-me />

       

              <!--

              Uncomment to enable X509 client authentication support

                  <x509 />

              -->   

       

              <!--

                  All of this is unnecessary if auto-config="true"

              <form-login />

              <anonymous />

              <http-basic />

              <logout />

              <remember-me />

              -->

       

              <!-- Uncomment to limit the number of sessions a user can have

              <concurrent-session-control max-sessions="1" exception-if-maximum-exceeded="true"/>

              -->       

          </http>

       

          <!-- Default DAO Authentication Provider -->       

          <authentication-provider user-service-ref="userDetailsService">       

          </authentication-provider>

       

      </beans:beans>

       

      1.Here security-application-context.xml is getting loaded from web.xml, still getting the error.

      2. I tried by adding security: prefix to http tags in security-app.xml file, but still error is occuring.

       

      Please let me know where could be the problem. I am using AS5.1 with default deployment option.

        • 1. springSecurityFilterChain filter not loaded in JBOss 5.1 deployment
          alesj

          What about if you use Snowdrop?

          * http://www.jboss.org/snowdrop

          • 2. springSecurityFilterChain filter not loaded in JBOss 5.1 deployment
            marius.bogoevici

            Definitely needs Snowdrop. There's a "classpath:*spring-*.xml" resource location in web.xml.

            • 3. springSecurityFilterChain filter not loaded in JBOss 5.1 deployment
              sanintel3

              I am new to JBOSS. Can you throw some more light on what is snow drop. It seems we need to use these libraries to integrate with JBOSS. But will it work in tomcat as well. We need to use the app on both tomcat and JBOSS as well. Apart from this, is there any other solution? Just want to understand why this problem is occuring only in JBOSS 5.1? I could able to deploy it in 4.2.3 version.

              • 4. springSecurityFilterChain filter not loaded in JBOss 5.1 deployment
                marius.bogoevici

                You are a couple a clicks away

                 

                http://community.jboss.org/wiki/READTHISFIRSTIntegrationwithSpringandProjectSnowdrop

                 

                Relevant in your case:

                 

                https://issues.jboss.org/browse/SNOWDROP-4

                 

                Although you don't do classpath scanning, the contextConfigLocation is using a wildcard classpath, which typically results in the same issues.

                 

                The relevant bits from the Snowdrop doc are:

                http://docs.jboss.org/snowdrop/1.0.1/html/ch02.html#d0e70

                 

                BTW, I didn't ask you, but you seem to be using Spring 2.5.6 - is that correct?

                • 5. springSecurityFilterChain filter not loaded in JBOss 5.1 deployment
                  sanintel3

                  After updating web.xml with snowdrop context class and the jars(snowdrop) to WEB-INF/lib of war file still getting the exception.

                   

                  2011-02-04 13:59:54,648 INFO  [org.jboss.spring.vfs.context.VFSXmlWebApplicationContext] (main) Refreshing org.jboss.spring.vfs.context.VFSXmlWebApplicationContext@1b8cfa0: display name [Root WebApplicationContext]; startup date [Fri Feb 04 13:59:54 IST 2011]; root of context hierarchy

                  2011-02-04 14:00:01,039 INFO  [org.jboss.spring.vfs.context.VFSXmlWebApplicationContext] (main) Bean factory for application context [org.jboss.spring.vfs.context.VFSXmlWebApplicationContext@1b8cfa0]: org.springframework.beans.factory.support.DefaultListableBeanFactory@8122ba

                  2011-02-04 14:00:01,070 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (main) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@8122ba: defining beans []; root of factory hierarchy

                  2011-02-04 14:00:01,070 INFO  [org.springframework.web.context.ContextLoader] (main) Root WebApplicationContext: initialization completed in 6453 ms

                  2011-02-04 14:00:01,086 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/bcp]] (main) 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:387)

                      at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:971)

                      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246)

                      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

                      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168)

                      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:884)

                      at org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:216)

                      at org.springframework.web.filter.DelegatingFilterProxy.initFilterBean(DelegatingFilterProxy.java:145)

                      at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:179)

                      at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:234)

                   

                   

                   

                  Though from logs it's clear that it's considering VFSXmlWebApplicationContext to load the spring resources, but still getting the error.

                  Also getting below exception

                   

                  2011-02-04 14:00:01,773 ERROR [com.webex.util.Logger] (main) [FreemarkerManager]

                  java.lang.ClassNotFoundException: context from BaseClassLoader@1826b7a{VFSClassLoaderPolicy@15e54e8{name=vfszip:/C:/Program%20Files/jboss-5.1/server/default/deploy/bcp.war/ domain=ClassLoaderDomain@146d5dc{name=com.loader:loader=service-web parentPolicy=BEFORE parent=ClassLoaderDomain@11a4bd4{DefaultDomain}} roots=[MemoryContextHandler@1604936[path= context=vfsmemory://1s2v3q48-c0zfap-gjqu2whq-1-gjqu3egf-29 real=vfsmemory://1s2v3q48-c0zfap-gjqu2whq-1-gjqu3egf-29], ZipEntryHandler@29966225[path=bcp.war/WEB-INF/classes context=file:/C:/Program%20Files/jboss-5.1/server/default/deploy/ real=file:/C:/Program%20Files/jboss-5.1/server/default/deploy/bcp.war/WEB-INF/classes], DelegatingHandler@23875759[path=bcp.war/WEB-INF/lib/XmlSchema-1.4.2.jar context=file:/C:/Program%20Files/jboss-5.1/server/default/deploy/ real=file:/C:/Program%20Files/jboss-5.1/server/default/deploy/bcp.war/WEB-INF/lib/XmlSchema-1.4.2.jar], DelegatingHandler@2442542[path=bcp.war/WEB-INF/lib/activation-1.1.jar context=file:/C:/Program%20Files/jboss-5.1/server/default/deploy/ real=file:/C:/Program%20Files/jboss-5.1/server/default/deploy/bcp.war/WEB-INF/lib/activation-1.1.jar],

                  DelegatingHandler@12725032[path=bcp.war/WEB-INF/lib/struts2-core-2.1.6.jar context=file:/C:/Program%20Files/jboss-5.1/server/default/deploy/ real=file:/C:/Program%20Files/jboss-5.1/server/default/deploy/bcp.war/WEB-INF/lib/struts2-core-2.1.6.jar],

                  DelegatingHandler@23833340[path=bcp.war/WEB-INF/lib/freemarker-2.3.13.jar context=file:/C:/Program%20Files/jboss-5.1/server/default/deploy/ real=file:/C:/Program%20Files/jboss-5.1/server/default/deploy/bcp.war/WEB-INF/lib/freemarker-2.3.13.jar],

                   

                  From the complete log, I could able to see that struts.jar(which is containing Freemarkermanager) is in the path where VFSClassloader is searching, but still it says classnotFound. What could be the reason for it?


                  Help me in understanding the concept.

                  • 6. springSecurityFilterChain filter not loaded in JBOss 5.1 deployment
                    sanintel3

                    Forgot to mention, we are using spring 2.5.6

                    • 7. springSecurityFilterChain filter not loaded in JBOss 5.1 deployment
                      sanintel3

                      Marius,

                      Just to add more information, with DEBUG log level, from logs I could able to see that no beans were loaded to webapplicationcontext.

                       

                      2011-02-04 16:03:54,412 INFO  [org.jboss.spring.vfs.context.VFSXmlWebApplicationContext] (main) Refreshing org.jboss.spring.vfs.context.VFSXmlWebApplicationContext@1df7bea: display name [Root WebApplicationContext]; startup date [Fri Feb 04 16:03:54 IST 2011]; root of context hierarchy

                      2011-02-04 16:03:54,459 DEBUG [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (main) Loaded 0 bean definitions from location pattern [classpath*:struts-spring-plugin.xml]

                      2011-02-04 16:04:00,412 DEBUG [org.jboss.spring.vfs.VFSResourcePatternResolvingHelper] (main) Scanning url: vfsmemory://1s2v3q48-lg69m5-gjqyibob-1-gjqyitso-29/, sub-pattern: *spring-*.xml

                      2011-02-04 16:04:00,412 DEBUG [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (main) Loaded 0 bean definitions from location pattern [classpath:*spring-*.xml]

                      2011-02-04 16:04:00,412 INFO  [org.jboss.spring.vfs.context.VFSXmlWebApplicationContext] (main) Bean factory for application context [org.jboss.spring.vfs.context.VFSXmlWebApplicationContext@1df7bea]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1693cba

                      2011-02-04 16:04:00,412 DEBUG [org.jboss.spring.vfs.context.VFSXmlWebApplicationContext] (main) 0 beans defined in org.jboss.spring.vfs.context.VFSXmlWebApplicationContext@1df7bea: display name [Root WebApplicationContext]; startup date [Fri Feb 04 16:03:54 IST 2011]; root of context hierarchy

                       

                       

                      Did I miss any other configuration apart from the steps mentioned above, to work with snowdrop?

                      • 8. springSecurityFilterChain filter not loaded in JBOss 5.1 deployment
                        sanintel3

                        Marius,
                        Thanks alot for pointing out the problem. So finally I changed web.xml configLocation with /WEB-INF/classes/*spring-*.xml pattern then it's working fine. But not sure why it's not working with classpath*: pattern, even with snowdrop configuration.

                         

                        If possible, please let me know if I missed something from snowdrop configuration/steps point of view

                        • 9. springSecurityFilterChain filter not loaded in JBOss 5.1 deployment
                          marius.bogoevici

                          Hi Santosh,

                           

                          Please note that classpath:*spring-*.xml is not very reliable, due to the way in which Spring resolves this types of paths (first it finds one resource that corresponds to "/" and then it scans for the resources that match the pattern underneath it).

                           

                          You can try classpath*:*spring-*.xml

                          • 10. springSecurityFilterChain filter not loaded in JBOss 5.1 deployment
                            sanintel3

                            But, with classpath*:*spring-*.xml configuration, I am getting exception even after using snowdrop. Please let me know if I miss any configuration.