Announcement Announcement Module
Collapse
No announcement yet.
Problems with DelegatingFilterProxy Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems with DelegatingFilterProxy

    Hi,

    I am adding Spring Security in my project, but I am having some problems. I looked a lot of example and the code is correct. Is the version of Spring the problem?

    The version of Spring that I am using are these:
    Spring Framework: 3.2.0.RELEASE
    Spring Security: 3.1.3.RELEASE

    My web.xml
    Code:
      <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
          /WEB-INF/classes/applicationContext.xml
        </param-value>
      </context-param> 
      
      <listener>
        <listener-class>
          org.springframework.web.context.ContextLoaderListener
        </listener-class>
      </listener> 
      
      <!-- Configurações do SpringSecurity -->
      <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:

    Code:
    SEVERE: WebModule[/project.jsf.ui]PWC1270: Exception starting filter springSecurityFilterChain
    java.lang.InstantiationException
    	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:124)
    	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4685)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:5377)
    	at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
    	at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2019)
    	at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)
    	at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
    	at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
    	at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
    	at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
    	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
    	at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:375)
    	at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:219)
    	at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:131)
    	at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
    	at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
    	at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
    	at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
    	at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:78)
    	at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:253)
    	at com.sun.enterprise.v3.server.AppServerStartup.doStart(AppServerStartup.java:145)
    	at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:136)
    	at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.start(GlassFishImpl.java:79)
    	at com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.start(GlassFishDecorator.java:63)
    	at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishImpl.start(OSGiGlassFishImpl.java:69)
    	at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:117)
    	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 com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
    	at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:55
    
    Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:549)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1096)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:278)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
    	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1121)
    	at org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:326)
    	at org.springframework.web.filter.DelegatingFilterProxy.initFilterBean(DelegatingFilterProxy.java:236)
    	at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:194)
    	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:264)
    	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:120)
    	... 34 more

  • #2
    I got to resolve this problem.
    Not is a compatibility problem.

    My code:

    web.xml
    Code:
      <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
          /WEB-INF/classes/applicationContext.xml
        </param-value>
      </context-param> 
      
      <listener>
        <listener-class>
          org.springframework.web.context.ContextLoaderListener
        </listener-class>
      </listener> 
      
      <!-- Configurações do SpringSecurity -->
      <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>
    applicationContext
    Code:
      <sec:http auto-config="false">
        <sec:session-management session-fixation-protection="none" />
        <sec:form-login login-page="/pages/public/login.xhtml" default-target-url="/resources/home.xhtml"/>
      </sec:http>
      
    
      <sec:authentication-manager>
        <sec:authentication-provider>
          <sec:jdbc-user-service 
            data-source-ref="dataSource"
            users-by-username-query = "SELECT SQL CODE"
            authorities-by-username-query= "SELECT SQL CODE"
     
          />
                                  
        </sec:authentication-provider>
      </sec:authentication-manager>
    Originally posted by colombelli View Post
    Hi,

    I am adding Spring Security in my project, but I am having some problems. I looked a lot of example and the code is correct. Is the version of Spring the problem?

    The version of Spring that I am using are these:
    Spring Framework: 3.2.0.RELEASE
    Spring Security: 3.1.3.RELEASE

    My web.xml
    Code:
      <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
          /WEB-INF/classes/applicationContext.xml
        </param-value>
      </context-param> 
      
      <listener>
        <listener-class>
          org.springframework.web.context.ContextLoaderListener
        </listener-class>
      </listener> 
      
      <!-- Configurações do SpringSecurity -->
      <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:

    Code:
    SEVERE: WebModule[/project.jsf.ui]PWC1270: Exception starting filter springSecurityFilterChain
    java.lang.InstantiationException
    	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:124)
    	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4685)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:5377)
    	at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
    	at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2019)
    	at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)
    	at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
    	at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
    	at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
    	at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
    	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
    	at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:375)
    	at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:219)
    	at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:131)
    	at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
    	at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
    	at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
    	at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
    	at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:78)
    	at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:253)
    	at com.sun.enterprise.v3.server.AppServerStartup.doStart(AppServerStartup.java:145)
    	at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:136)
    	at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.start(GlassFishImpl.java:79)
    	at com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.start(GlassFishDecorator.java:63)
    	at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishImpl.start(OSGiGlassFishImpl.java:69)
    	at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:117)
    	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 com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
    	at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:55
    
    Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:549)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1096)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:278)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
    	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1121)
    	at org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:326)
    	at org.springframework.web.filter.DelegatingFilterProxy.initFilterBean(DelegatingFilterProxy.java:236)
    	at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:194)
    	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:264)
    	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:120)
    	... 34 more

    Comment

    Working...
    X