New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Grails 3.3.0.M2 & Spring Security Core 3.3.0-RC2 #140

Closed
sagrawal31 opened this Issue Jun 2, 2017 · 21 comments

Comments

Projects
None yet
7 participants
@sagrawal31
Copy link
Contributor

sagrawal31 commented Jun 2, 2017

We have to use spring-security-core version > 3.3.0-RC2 for Grails 3.3.0.M2 app but when I'm running "org.grails.plugins:spring-security-oauth2-provider:3.0.0-RC2" installed with "org.grails.plugins:spring-security-core:3.3.0.M1" I'm getting following exception on startup:

| Running application...
objc[34916]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java (0x1005644c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x101de24e0). One of the two will be used. Which one is undefined.

Configuring Spring Security Core ...
... finished configuring Spring Security Core

Configuring Spring Security OAuth2 provider ...
2017-06-02 14:31:07.302 ERROR --- [           main] o.s.boot.SpringApplication               : Application startup failed

java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/FilterRegistrationBean
        at grails.plugin.springsecurity.oauthprovider.SpringSecurityOauth2ProviderGrailsPlugin$_closure15$_closure46.doCall(SpringSecurityOauth2ProviderGrailsPlugin.groovy:553)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
        at groovy.lang.Closure.call(Closure.java:414)
        at groovy.lang.Closure.call(Closure.java:430)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2025)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2066)
        at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at grails.plugin.springsecurity.oauthprovider.SpringSecurityOauth2ProviderGrailsPlugin$_closure15.doCall(SpringSecurityOauth2ProviderGrailsPlugin.groovy:539)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
        at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1252)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:810)
        at grails.plugins.Plugin.invokeMethod(Plugin.groovy)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects(ClosureMetaClass.java:430)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:369)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:158)
        at grails.plugin.springsecurity.oauthprovider.SpringSecurityOauth2ProviderGrailsPlugin$_doWithSpring_closure16.doCall(SpringSecurityOauth2ProviderGrailsPlugin.groovy:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
        at groovy.lang.Closure.call(Closure.java:414)
        at groovy.lang.Closure.call(Closure.java:408)
        at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:759)
        at grails.spring.BeanBuilder.beans(BeanBuilder.java:588)
        at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:531)
        at org.grails.plugins.DefaultGrailsPlugin.doWithRuntimeConfiguration(DefaultGrailsPlugin.java:559)
        at org.grails.plugins.AbstractGrailsPluginManager.doRuntimeConfiguration(AbstractGrailsPluginManager.java:167)
        at grails.boot.config.GrailsApplicationPostProcessor.postProcessBeanDefinitionRegistry(GrailsApplicationPostProcessor.groovy:171)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
        at grails.boot.GrailsApp.run(GrailsApp.groovy:83)
        at grails.boot.GrailsApp.run(GrailsApp.groovy:388)
        at grails.boot.GrailsApp.run(GrailsApp.groovy:375)
        at grails.boot.GrailsApp$run.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
        at test330m2.Application.main(Application.groovy:8)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.embedded.FilterRegistrationBean
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 75 common frames omitted

I'm attaching a fresh sample app reproducing the same issue https://github.com/wizpanda/oauth2-issue

I think this is because spring versions are upgraded in Grails 3.3.0.M2 but couldn't get time to debug more.

@sagrawal31

This comment has been minimized.

Copy link
Contributor

sagrawal31 commented Jun 2, 2017

sagrawal31 added a commit to wizpanda/grails-spring-security-oauth2-provider that referenced this issue Jun 2, 2017

@sagrawal31

This comment has been minimized.

Copy link
Contributor

sagrawal31 commented Jun 2, 2017

I tried to upgrade it to 3.3.0.M2 in PR #141 but I'm missing something.

sagrawal31 added a commit to wizpanda/grails-spring-security-oauth2-provider that referenced this issue Jun 2, 2017

sagrawal31 added a commit to wizpanda/grails-spring-security-oauth2-provider that referenced this issue Jun 2, 2017

sagrawal31 added a commit to wizpanda/grails-spring-security-oauth2-provider that referenced this issue Jun 2, 2017

@sagrawal31

This comment has been minimized.

Copy link
Contributor

sagrawal31 commented Nov 4, 2017

@bluesliverx @bobby-vandiver any update on this? Can you guys please take a quick look

@bluesliverx

This comment has been minimized.

Copy link
Owner

bluesliverx commented Nov 13, 2017

Sorry @sagrawal31, I just haven't upgraded to grails 3 at all yet and don't have any tests available for it, and the project has changed enough that I'm not as familiar with the build process to know what's going to work or not. Maybe @bobby-vandiver can comment on this or your PR.

@abitul

This comment has been minimized.

Copy link

abitul commented Nov 17, 2017

please help , i have same issue when using grails 3.3.0 and oauth2 plugin version 3.0.0-RC1

java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/FilterRegistrationBean
at grails.plugin.springsecurity.oauthprovider.SpringSecurityOauth2ProviderGrailsPlugin$_closure15$_closure46.doCall(SpringSecurityOauth2ProviderGrailsPlugin.groovy:553)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2025)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2066)
at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at grails.plugin.springsecurity.oauthprovider.SpringSecurityOauth2ProviderGrailsPlugin$_closure15.doCall(SpringSecurityOauth2ProviderGrailsPlugin.groovy:539)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1252)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:810)
at grails.plugins.Plugin.invokeMethod(Plugin.groovy)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects(ClosureMetaClass.java:430)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:369)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:158)
at grails.plugin.springsecurity.oauthprovider.SpringSecurityOauth2ProviderGrailsPlugin$_doWithSpring_closure16.doCall(SpringSecurityOauth2ProviderGrailsPlugin.groovy:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:408)
at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:759)
at grails.spring.BeanBuilder.beans(BeanBuilder.java:588)
at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:531)
at org.grails.plugins.DefaultGrailsPlugin.doWithRuntimeConfiguration(DefaultGrailsPlugin.java:559)
at org.grails.plugins.AbstractGrailsPluginManager.doRuntimeConfiguration(AbstractGrailsPluginManager.java:167)
at grails.boot.config.GrailsApplicationPostProcessor.postProcessBeanDefinitionRegistry(GrailsApplicationPostProcessor.groovy:171)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at grails.boot.GrailsApp.run(GrailsApp.groovy:83)
at grails.boot.GrailsApp.run(GrailsApp.groovy:388)
at grails.boot.GrailsApp.run(GrailsApp.groovy:375)
at grails.boot.GrailsApp$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at rest.api.demakmotor.Application.main(Application.groovy:8)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.embedded.FilterRegistrationBean
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 75 common frames omitted

2017-11-17 13:29:21.182 ERROR --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with name 'grailsApplicationPostProcessor' threw an exception

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@72ccd81a: startup date [Fri Nov 17 13:29:09 WIB 2017]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:414)
at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1006)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:958)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:750)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at grails.boot.GrailsApp.run(GrailsApp.groovy:83)
at grails.boot.GrailsApp.run(GrailsApp.groovy:388)
at grails.boot.GrailsApp.run(GrailsApp.groovy:375)
at grails.boot.GrailsApp$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at rest.api.demakmotor.Application.main(Application.groovy:8)

2017-11-17 13:29:21.190 ERROR --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@72ccd81a: startup date [Fri Nov 17 13:29:09 WIB 2017]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:414)
at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1006)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:958)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:750)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at grails.boot.GrailsApp.run(GrailsApp.groovy:83)
at grails.boot.GrailsApp.run(GrailsApp.groovy:388)
at grails.boot.GrailsApp.run(GrailsApp.groovy:375)
at grails.boot.GrailsApp$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at rest.api.demakmotor.Application.main(Application.groovy:8)

@sagrawal31

This comment has been minimized.

Copy link
Contributor

sagrawal31 commented Nov 17, 2017

@abitul

This comment has been minimized.

Copy link

abitul commented Nov 18, 2017

@sagrawal31 can u give me example please?

@sagrawal31

This comment has been minimized.

Copy link
Contributor

sagrawal31 commented Nov 18, 2017

I created a file:

src/main/groovy/org/springframework/boot/context/embedded/FilterRegistrationBean.java

package org.springframework.boot.context.embedded;

import org.springframework.boot.web.servlet.ServletRegistrationBean;

import javax.servlet.Filter;

// https://github.com/bluesliverx/grails-spring-security-oauth2-provider/issues/140
public class FilterRegistrationBean extends org.springframework.boot.web.servlet.FilterRegistrationBean {

    public FilterRegistrationBean() {
    }

    public FilterRegistrationBean(Filter filter, ServletRegistrationBean... servletRegistrationBeans) {
        super(filter, servletRegistrationBeans);
    }
}

And this solved my issue.

@abitul

This comment has been minimized.

Copy link

abitul commented Nov 21, 2017

thanks @sagrawal31 , but i get bad credentials-client
{
"error": "invalid_client",
"error_description": "Bad client credentials"
}

any solution ? please help

@sagrawal31

This comment has been minimized.

Copy link
Contributor

sagrawal31 commented Nov 26, 2017

Hmmm...I get that too. I have wasted two days on this problem. In Grails 3.3 by default, event listeners (beforeUpdate or beforeSave) are disabled for performance reason so the password stored in the database in the client secret is in the plain text instead of encrypted text. So enable that or use the way described in the doc.

@bobby-vandiver

This comment has been minimized.

Copy link
Collaborator

bobby-vandiver commented Nov 29, 2017

@sagrawal31 Sorry I haven't had time to look at this. I've just been super busy lately. I'm hoping to find time later this week or next week to dig into this more.

@davydotcom

This comment has been minimized.

Copy link

davydotcom commented Dec 8, 2017

any chance we can get a release on this? stuck on it as well

@piperpilot

This comment has been minimized.

Copy link

piperpilot commented Mar 7, 2018

Any update on this @bobby-vandiver, @bluesliverx or @sagrawal31?

The plugin seems to be broken in grails3.3 and thus unusable. Any help would be appreciated!

@sagrawal31

This comment has been minimized.

Copy link
Contributor

sagrawal31 commented Mar 8, 2018

@piperpilot You can very well use this plugin with the workarounds available, for now!

@piperpilot

This comment has been minimized.

Copy link

piperpilot commented Mar 8, 2018

Any suggestion how to get around the session/transaction issues like this:

[07 Mar 2018 17:13:50.508] ERROR - [http-nio-8080-exec-9] o.g.w.errors.GrailsExceptionResolver - HibernateException occurred when processing request: [GET] /oauth/authorize - parameters: response_type: code client_id: my-client scope: read No Session found for current thread. Stacktrace follows: org.springframework.dao.DataAccessResourceFailureException: Could not obtain current Hibernate Session; nested exception is org.hibernate.HibernateException: No Session found for current thread at org.grails.orm.hibernate.GrailsHibernateTemplate.getSession(GrailsHibernateTemplate.java:337) at org.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:286) at org.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:243) at org.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:117) at org.grails.orm.hibernate.AbstractHibernateGormStaticApi.findWhere(AbstractHibernateGormStaticApi.groovy:611) at org.grails.datastore.gorm.GormStaticApi.findWhere(GormStaticApi.groovy:770) at org.grails.datastore.gorm.GormEntity$Trait$Helper.findWhere(GormEntity.groovy:852) at grails.plugin.springsecurity.oauthprovider.GormClientDetailsService.loadClientByClientId(GormClientDetailsService.groovy:25) at grails.plugin.springsecurity.oauthprovider.provider.GrailsOAuth2RequestFactory.extractScopes(GrailsOAuth2RequestFactory.java:102) at grails.plugin.springsecurity.oauthprovider.provider.GrailsOAuth2RequestFactory.createAuthorizationRequest(GrailsOAuth2RequestFactory.java:60) at org.springframework.security.oauth2.provider.endpoint.AuthorizationEndpoint.authorize(AuthorizationEndpoint.java:123) at grails.plugin.springsecurity.oauthprovider.endpoint.WrappedAuthorizationEndpoint.authorize(WrappedAuthorizationEndpoint.java:20) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) at grails.plugin.springsecurity.web.UpdateRequestContextHolderExceptionTranslationFilter.doFilter(UpdateRequestContextHolderExceptionTranslationFilter.groovy:64) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.groovy:54) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:158) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at grails.plugin.springsecurity.rest.RestAuthenticationFilter.doFilter(RestAuthenticationFilter.groovy:139) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.groovy:64) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at grails.plugin.springsecurity.rest.RestLogoutFilter.doFilter(RestLogoutFilter.groovy:82) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:82) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at grails.plugin.springsecurity.web.SecurityRequestHolderFilter.doFilter(SecurityRequestHolderFilter.groovy:58) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177) at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:77) at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.hibernate.HibernateException: No Session found for current thread at org.grails.orm.hibernate.GrailsSessionContext.currentSession(GrailsSessionContext.java:117) at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:688) at org.grails.orm.hibernate.GrailsHibernateTemplate.getSession(GrailsHibernateTemplate.java:335) ... 57 common frames omitted
Looks to me like maybe your pull request #141 fixes some of these issues? Or perhaps its RC2 that might fix them, but that isn't available in Maven unless I'm missing something. I'm trying to avoid forking the code and building the plugin locally to troubleshoot the issues.

Thanks,
Curtis

@piperpilot

This comment has been minimized.

Copy link

piperpilot commented Mar 8, 2018

OK, sorry for anyone that gets here, I was able to find this issue that explains the transactional/session problem:

#114

Which shows a fix in RC2 which can be installed by adding a different maven repository...you can find the info here:

#119

@paulito415

This comment has been minimized.

Copy link

paulito415 commented Jun 21, 2018

Thanks to @sagrawal31 I was able to get past the issue with the FilterRegistrationBean. The version I'm using now is actually 3.0.0-RC2. My server now starts up fine. But unfortunately I'm still getting another issue when trying to authenticate with the /oauth/token end point. The error response I received was:
{ "error": "unauthorized", "error_description": "No transactionManager was specified. Using @Transactional or @Rollback requires a valid configured transaction manager. If you are running in a unit test ensure the test has been properly configured and that you run the test suite not an individual test method." }

Naturally I suspected that this was due to the change in the 'Transactional' package name change according to http://docs.grails.org/latest/guide/upgrading.html. But this probably wouldn't be so easily fixable as hacking / creating a dummy Transactional class like for FilterRegistrationBean. I will try anyway.

Has anyone else seen this? Are @bluesliverx and @bobby-vandiver and @dynamind monitoring this chat? It would seem like very small changes that would be needed to fix this but I myself also have no experience with building a plugin. Any ideas on how to move forward?

Thanks,
Paul

@paulito415

This comment has been minimized.

Copy link

paulito415 commented Jun 24, 2018

So thinking that the issue is in the TokenEndPoint, which serves up /oauth/token, I upgraded it from 2.0.9 RELEASE to 2.3.3 RELEASE. I turned up logging in logback.groovy for org.springframework.security.oauth2 and found that the authentication did succeed, as shown below

2018-06-24 09:30:22.848 DEBUG --- [nio-8080-exec-2] o.s.s.o.p.a.BearerTokenExtractor : Token not found in headers. Trying request parameters.
2018-06-24 09:30:22.850 DEBUG --- [nio-8080-exec-2] o.s.s.o.p.a.BearerTokenExtractor : Token not found in request parameters. Not an OAuth2 request.
2018-06-24 09:30:22.850 DEBUG --- [nio-8080-exec-2] p.a.OAuth2AuthenticationProcessingFilter : No token in request, will continue chain.
2018-06-24 09:30:22.851 DEBUG --- [nio-8080-exec-2] p.c.ClientCredentialsTokenEndpointFilter : Request is to process authentication
2018-06-24 09:30:23.023 DEBUG --- [nio-8080-exec-2] p.c.ClientCredentialsTokenEndpointFilter : Authentication success. Updating SecurityContextHolder to contain: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@f9e0337c: Principal: org.springframework.security.core.userdetails.User@361cd70c: Username: my-client; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_CLIENT; Credentials: [PROTECTED]; Authenticated: true; Details: null; Granted Authorities: ROLE_CLIENT
2018-06-24 09:30:23.225 DEBUG --- [nio-8080-exec-2] .o.p.p.ResourceOwnerPasswordTokenGranter : Getting access token for: my-client

but for some reason on the way back in the response, I get the "unauthorized" JSON as I posted above. Are there other packages I should turn up logging for instead?

BTW is this thread dead? What is the expected response time on something like this? Should I just open up another thread (which tracks my issue rather than the original one this discussion is focused on)?

@paulito415

This comment has been minimized.

Copy link

paulito415 commented Jun 24, 2018

After finding out that the Transaction annotation usage is in 4 classes in grails.plugin.springsecurity.oauthprovider package (GormApprovalStoreService, GormAuthorizationCodeService, GormClientDetailsService, GormTokenStoreService), I turned up logging for grails.plugin.springsecurity.oauthprovider and found something more:

2018-06-25 00:18:50.780 DEBUG --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/oauth/token'; against '/assets/'
2018-06-25 00:18:50.780 DEBUG --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/oauth/token'; against '/
/js/'
2018-06-25 00:18:50.780 DEBUG --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/oauth/token'; against '/
/css/'
2018-06-25 00:18:50.780 DEBUG --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/oauth/token'; against '/
/images/'
2018-06-25 00:18:50.780 DEBUG --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/oauth/token'; against '/
/favicon.ico'
2018-06-25 00:18:50.780 DEBUG --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/oauth/token'; against '/'
2018-06-25 00:18:50.780 DEBUG --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/oauth/token'; against '/auth/'
2018-06-25 00:18:50.780 DEBUG --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/oauth/token'; against '/rest/
'
2018-06-25 00:18:50.780 DEBUG --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/oauth/token'; against '/retailer/'
2018-06-25 00:18:50.780 DEBUG --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Request '/oauth/token' matched by universal pattern '/
'
2018-06-25 00:18:50.781 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /oauth/token at position 1 of 14 in additional filter chain; firing Filter: 'SecurityRequestHolderFilter'
2018-06-25 00:18:50.781 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /oauth/token at position 2 of 14 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
2018-06-25 00:18:50.782 DEBUG --- [nio-8080-exec-1] w.c.HttpSessionSecurityContextRepository : Obtained a valid SecurityContext from SPRING_SECURITY_CONTEXT: 'org.springframework.security.core.context.SecurityContextImpl@f9e0337c: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@f9e0337c: Principal: org.springframework.security.core.userdetails.User@361cd70c: Username: my-client; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_CLIENT; Credentials: [PROTECTED]; Authenticated: true; Details: null; Granted Authorities: ROLE_CLIENT'
2018-06-25 00:18:50.782 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /oauth/token at position 3 of 14 in additional filter chain; firing Filter: 'StatelessSecurityContextPersistenceFilter'
2018-06-25 00:18:50.782 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /oauth/token at position 4 of 14 in additional filter chain; firing Filter: 'MutableLogoutFilter'
2018-06-25 00:18:50.782 DEBUG --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/oauth/token'; against '/logoff'
2018-06-25 00:18:50.782 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /oauth/token at position 5 of 14 in additional filter chain; firing Filter: 'OAuth2AuthenticationProcessingFilter'
2018-06-25 00:18:50.783 DEBUG --- [nio-8080-exec-1] o.s.s.o.p.a.BearerTokenExtractor : Token not found in headers. Trying request parameters.
2018-06-25 00:18:50.783 DEBUG --- [nio-8080-exec-1] o.s.s.o.p.a.BearerTokenExtractor : Token not found in request parameters. Not an OAuth2 request.
2018-06-25 00:18:50.783 DEBUG --- [nio-8080-exec-1] p.a.OAuth2AuthenticationProcessingFilter : Clearing security context.
2018-06-25 00:18:50.783 DEBUG --- [nio-8080-exec-1] p.a.OAuth2AuthenticationProcessingFilter : No token in request, will continue chain.
2018-06-25 00:18:50.783 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /oauth/token at position 6 of 14 in additional filter chain; firing Filter: 'GrailsUsernamePasswordAuthenticationFilter'
2018-06-25 00:18:50.783 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /oauth/token at position 7 of 14 in additional filter chain; firing Filter: 'ClientCredentialsTokenEndpointFilter'
2018-06-25 00:18:50.783 DEBUG --- [nio-8080-exec-1] p.c.ClientCredentialsTokenEndpointFilter : Request is to process authentication
2018-06-25 00:18:50.783 DEBUG --- [nio-8080-exec-1] o.s.s.authentication.ProviderManager : Authentication attempt using org.springframework.security.authentication.dao.DaoAuthenticationProvider
2018-06-25 00:18:50.811 DEBUG --- [nio-8080-exec-1] p.c.ClientCredentialsTokenEndpointFilter : Authentication success. Updating SecurityContextHolder to contain: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@f9e0337c: Principal: org.springframework.security.core.userdetails.User@361cd70c: Username: my-client; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_CLIENT; Credentials: [PROTECTED]; Authenticated: true; Details: null; Granted Authorities: ROLE_CLIENT
2018-06-25 00:18:50.811 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /oauth/token at position 8 of 14 in additional filter chain; firing Filter: 'BasicAuthenticationFilter'
2018-06-25 00:18:50.811 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /oauth/token at position 9 of 14 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'
2018-06-25 00:18:50.812 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /oauth/token at position 10 of 14 in additional filter chain; firing Filter: 'GrailsRememberMeAuthenticationFilter'
2018-06-25 00:18:50.812 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /oauth/token at position 11 of 14 in additional filter chain; firing Filter: 'GrailsAnonymousAuthenticationFilter'
2018-06-25 00:18:50.812 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /oauth/token at position 12 of 14 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'
2018-06-25 00:18:50.812 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /oauth/token at position 13 of 14 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'
2018-06-25 00:18:50.812 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /oauth/token at position 14 of 14 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'
2018-06-25 00:18:50.814 DEBUG --- [nio-8080-exec-1] o.s.s.w.a.i.FilterSecurityInterceptor : Public object - authentication not attempted
2018-06-25 00:18:50.814 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /oauth/token reached end of additional filter chain; proceeding with original chain
2018-06-25 00:18:50.815 DEBUG --- [nio-8080-exec-1] tyOrderedFrameworkEndpointHandlerMapping : Looking up handler method for path /oauth/token
2018-06-25 00:18:50.815 DEBUG --- [nio-8080-exec-1] tyOrderedFrameworkEndpointHandlerMapping : Returning handler method [public org.springframework.http.ResponseEntity<org.springframework.security.oauth2.common.OAuth2AccessToken> grails.plugin.springsecurity.oauthprovider.endpoint.WrappedTokenEndpoint.postAccessToken(java.security.Principal,java.util.Map<java.lang.String, java.lang.String>) throws org.springframework.web.HttpRequestMethodNotSupportedException]
2018-06-25 00:18:50.857 DEBUG --- [nio-8080-exec-1] .o.p.p.ResourceOwnerPasswordTokenGranter : Getting access token for: my-client
2018-06-25 00:18:50.858 DEBUG --- [nio-8080-exec-1] o.s.s.authentication.ProviderManager : Authentication attempt using org.springframework.security.authentication.dao.DaoAuthenticationProvider
2018-06-25 00:18:50.858 INFO --- [nio-8080-exec-1] g.p.s.o.endpoint.WrappedTokenEndpoint : Handling error: InternalAuthenticationServiceException, No transactionManager was specified. Using @transactional or @Rollback requires a valid configured transaction manager. If you are running in a unit test ensure the test has been properly configured and that you run the test suite not an individual test method.
2018-06-25 00:18:50.860 DEBUG --- [nio-8080-exec-1] w.c.HttpSessionSecurityContextRepository : SecurityContext 'org.springframework.security.core.context.SecurityContextImpl@f9e0337c: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@f9e0337c: Principal: org.springframework.security.core.userdetails.User@361cd70c: Username: my-client; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_CLIENT; Credentials: [PROTECTED]; Authenticated: true; Details: null; Granted Authorities: ROLE_CLIENT' stored to HttpSession: 'org.apache.catalina.session.StandardSessionFacade@726023b
2018-06-25 00:18:50.862 DEBUG --- [nio-8080-exec-1] o.s.s.w.a.ExceptionTranslationFilter : Chain processed normally
2018-06-25 00:18:50.862 DEBUG --- [nio-8080-exec-1] o.s.s.w.a.ExceptionTranslationFilter : Chain processed normally
2018-06-25 00:18:50.862 DEBUG --- [nio-8080-exec-1] s.s.w.c.SecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed

Specifically, there were two observations:

  1. The culprit is the line "g.p.s.o.endpoint.WrappedTokenEndpoint : Handling error: InternalAuthenticationServiceException, No transactionManager was specified. Using @transactional or @Rollback requires a valid configured transaction manager. If you are running in a unit test ensure the test has been properly configured and that you run the test suite not an individual test method."
  2. For some reason, there were 2 lines logging "Authentication attempt using org.springframework.security.authentication.dao.DaoAuthenticationProvider", the first one resulted in a success and the second one leading to InternalAuthenticationServiceException

Maybe this means there are some issues in the way that I have my filters setup? Anyway, in debugging, I was trying to see the stack trace where the InternalAuthenticationServiceException was being caught, but looking on Google pointed to one way which is to configure a WebResponseExceptionTranslator so I can print the stack trace. Adding a breakpoint in IDEA didn't work either.

Can anyone here point me in the right direction? Thanks!

@paulito415

This comment has been minimized.

Copy link

paulito415 commented Jun 26, 2018

Dumped all my findings (with new ones) in a new issue #145 to let it be tracked as a new issue.

@bluesliverx

This comment has been minimized.

Copy link
Owner

bluesliverx commented Oct 13, 2018

Closed in favor of #145

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment