Announcement Announcement Module
Collapse
No announcement yet.
Spring security3 isEraseCredentialsAfterAuthentication() -No method found exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring security3 isEraseCredentialsAfterAuthentication() -No method found exception

    Hi,
    I am using spring security 3 and getting following exception.


    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityF ilterChain#0' while setting bean property 'sourceList' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.security.web.DefaultSecurityF ilterChain#0': Cannot resolve reference to bean 'org.springframework.security.web.authentication.U sernamePasswordAuthenticationFilter#0' while setting constructor argument with key [2]; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.security.web.authentication.U sernamePasswordAuthenticationFilter#0': Cannot resolve reference to bean 'org.springframework.security.authentication.Provi derManager#0' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.security.authentication.Provi derManager#0': Cannot create inner bean '(inner bean)' of type [org.springframework.beans.factory.config.MethodInv okingFactoryBean] while setting bean property 'eraseCredentialsAfterAuthentication'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '(inner bean)#9': Invocation of init method failed; nested exception is java.lang.NoSuchMethodException: $Proxy45.isEraseCredentialsAfterAuthentication()
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:329)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:107)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveManagedList(BeanDefinit ionValueResolver.java:354)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:154)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1360)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1118)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 94)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:225)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:291 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:587)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:925)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:472)
    at org.springframework.web.context.ContextLoader.conf igureAndRefreshWebApplicationContext(ContextLoader .java:383)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:283)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 111)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:4205)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4704)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1053)
    at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(Sta ndardService.java:525)
    at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalin a.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:414)

  • #2
    Can anyone please answer this ..I am stuck..

    Comment


    • #3
      ok .. I guess looking at the huge stack trace , no one is willing to answer this.
      Let me simplify it.These are last 2 chunks of stack trace in console .
      Looking for some responses.

      Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '(inner bean)#5': Invocation of init method failed; nested exception is java.lang.NoSuchMethodException: $Proxy41.isEraseCredentialsAfterAuthentication()
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1455)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:519)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveInnerBean(BeanDefinitio nValueResolver.java:271)
      ... 66 more
      Caused by: java.lang.NoSuchMethodException: $Proxy41.isEraseCredentialsAfterAuthentication()
      at java.lang.Class.getMethod(Class.java:1622)
      at org.springframework.util.MethodInvoker.prepare(Met hodInvoker.java:178)
      at org.springframework.beans.factory.config.MethodInv okingFactoryBean.afterPropertiesSet(MethodInvoking FactoryBean.java:149)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1514)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1452)
      ... 69 more

      Comment


      • #4
        Can someone please reply here.

        Comment


        • #5
          Can someone please help here ?
          Otherwise i will have to switch to some other security solution.
          Kindly help.

          Comment


          • #6
            Is this a bug a in Spring security ?

            Comment


            • #7
              It appears the problem is you are creating a proxy object (likely an interface based proxy) and so it cannot find the method. Are you using global method security or other forms of AOP? If so try disabling it.

              PS: Typically it helps if you post your configuration so others can reproduce the issue. Also please use code tags (i.e. the # button) in the future for posting anything requiring formatting (i.e. stack traces)

              Comment


              • #8
                Hi Rob,
                Thanks a lot for your reply.
                I am not creating any proxy object.
                I am declaring authentication manager bean in spring security xml as follows :-
                Code:
                <authentication-manager>
                  <authentication-provider user-service-ref="loginUserDetailsService" />
                </authentication-manager>
                and loginUserDetailsService is a bean in same file which is a java class (implementing UserDetailService) and returns an UserDetails object.

                About AOP - I am using aopalliance in my application which is defined in my root applicationContext.
                Is this the problem ?
                Last edited by Rob Winch; Nov 29th, 2012, 11:22 AM. Reason: Added Code tags

                Comment


                • #9
                  It is only a problem if you are joining on the Spring Security jars.

                  PS: Please use code tags (i.e. # button) when posting anything that should be formatted (i.e. stack traces, logs, code, XML, etc)

                  Comment


                  • #10
                    Sorry..but i did not get your point.What do you mean by joining with spring security jars.
                    I have all spring framework and security jars plus aopalliance jar in same directory (WEB-INF/lib).Is it a problem ?

                    Comment


                    • #11
                      Hi Rob,
                      Thanks for your help.
                      I removed aopalliance bean from my root applicationContext and things worked.
                      Can you please tell me whats the relationship between aopalliance bean and my spring security context ? Is there any conflict ?

                      Comment


                      • #12
                        I suggest you read about AOP in the Spring Reference. You might also look at the Getting Started with Spring Security 3.1 presentation from SpringOne 2011 at around 1 hour in. In short, when you proxy an object using interface based proxying, it exposes only the interface methods. You could switch to CGLIB based proxies, which will still have all the methods available on it. Keep in mind there are certain limitations with CGLIB proxies (i.e. cannot proxy final classes, non-default constructors, etc). Your other option is to just not join on the Spring Security project.

                        Comment

                        Working...
                        X