Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Spring security3 isEraseCredentialsAfterAuthentication() -No method found exception

  1. #1
    Join Date
    Nov 2012
    Posts
    9

    Default 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. #2
    Join Date
    Nov 2012
    Posts
    9

    Default

    Can anyone please answer this ..I am stuck..

  3. #3
    Join Date
    Nov 2012
    Posts
    9

    Default

    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

  4. #4
    Join Date
    Nov 2012
    Posts
    9

    Default

    Can someone please reply here.

  5. #5
    Join Date
    Nov 2012
    Posts
    9

    Default

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

  6. #6
    Join Date
    Nov 2012
    Posts
    9

    Default

    Is this a bug a in Spring security ?

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

    Default

    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)
    Rob Winch - @rob_winch
    Spring Security Lead
    Pivotal

  8. #8
    Join Date
    Nov 2012
    Posts
    9

    Default

    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 at 10:22 AM. Reason: Added Code tags

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

    Default

    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)
    Rob Winch - @rob_winch
    Spring Security Lead
    Pivotal

  10. #10
    Join Date
    Nov 2012
    Posts
    9

    Default

    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 ?

Posting Permissions

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