jeffwils / grails-spring-security-saml

Grails Spring Security SAML2.0 Plugin for Grails 3
8 stars 24 forks source link

Error creating bean with name 'securityTagLib': Invocation of init method failed; nested exception is java.lang.NullPointerException #62

Open kmekalasundaram opened 5 years ago

kmekalasundaram commented 5 years ago

When deploying my grails 3.3.9 app with grails-spring-security-saml 3.3.0 plugin on tomcat7/8 server, I get the runtime error "Error creating bean with name 'securityTagLib': Invocation of init method failed; nested exception is java.lang.NullPointerException"

build.gradle is as follows

    compile "org.grails:grails-core"
    compile "org.springframework.boot:spring-boot-starter-actuator"
    compile "org.springframework.boot:spring-boot-starter-tomcat"
    compile "org.springframework.boot:spring-boot-starter-security"
    compile 'org.grails.plugins:spring-security-core:3.2.3'
    compile 'org.grails.plugins:spring-security-saml:3.3.0'
    compile "org.grails:grails-plugin-url-mappings"
    compile "org.grails:grails-plugin-rest"
    compile "org.grails:grails-plugin-codecs"
    compile "org.grails:grails-plugin-interceptors"
    compile "org.grails:grails-plugin-services"
    compile "org.grails:grails-plugin-datasource"
    compile "org.grails:grails-plugin-databinding"
    compile "org.grails:grails-web-boot"
    compile "org.grails:grails-logging"
    compile "org.grails.plugins:cache"
    compile "org.grails.plugins:async"
    compile "org.grails.plugins:events"

I get the below msg during compilation:

2019-08-16 13:36:15.553  INFO 496 --- [ost-startStop-1] o.g.c.a.gsp.TagLibArtefactHandler        : There are conflicting tags: org.grails.plugin.springsecurity.saml.SamlTagLib.sec:access vs. grails.plugin.springsecurity.SecurityTagLib.sec:access. The former will take precedence.
2019-08-16 13:36:15.553  INFO 496 --- [ost-startStop-1] o.g.c.a.gsp.TagLibArtefactHandler        : There are conflicting tags: org.grails.plugin.springsecurity.saml.SamlTagLib.sec:noAccess vs. grails.plugin.springsecurity.SecurityTagLib.sec:noAccess. The former will take precedence.
2019-08-16 13:36:15.554  INFO 496 --- [ost-startStop-1] o.g.c.a.gsp.TagLibArtefactHandler        : There are conflicting tags: org.grails.plugin.springsecurity.saml.SamlTagLib.sec:ifNotLoggedIn vs. grails.plugin.springsecurity.SecurityTagLib.sec:ifNotLoggedIn. The former will take precedence.
2019-08-16 13:36:15.558  INFO 496 --- [ost-startStop-1] o.g.c.a.gsp.TagLibArtefactHandler        : There are conflicting tags: org.grails.plugin.springsecurity.saml.SamlTagLib.sec:link vs. grails.plugin.springsecurity.SecurityTagLib.sec:link. The former will take precedence.
2019-08-16 13:36:15.558  INFO 496 --- [ost-startStop-1] o.g.c.a.gsp.TagLibArtefactHandler        : There are conflicting tags: org.grails.plugin.springsecurity.saml.SamlTagLib.sec:ifAnyGranted vs. grails.plugin.springsecurity.SecurityTagLib.sec:ifAnyGranted. The former will take precedence.
2019-08-16 13:36:15.559  INFO 496 --- [ost-startStop-1] o.g.c.a.gsp.TagLibArtefactHandler        : There are conflicting tags: org.grails.plugin.springsecurity.saml.SamlTagLib.sec:ifLoggedIn vs. grails.plugin.springsecurity.SecurityTagLib.sec:ifLoggedIn. The former will take precedence.
2019-08-16 13:36:15.559  INFO 496 --- [ost-startStop-1] o.g.c.a.gsp.TagLibArtefactHandler        : There are conflicting tags: org.grails.plugin.springsecurity.saml.SamlTagLib.sec:switchedUserOriginalUsername vs. grails.plugin.springsecurity.SecurityTagLib.sec:switchedUserOriginalUsername. The former will take precedence.
2019-08-16 13:36:15.560  INFO 496 --- [ost-startStop-1] o.g.c.a.gsp.TagLibArtefactHandler        : There are conflicting tags: org.grails.plugin.springsecurity.saml.SamlTagLib.sec:ifSwitched vs. grails.plugin.springsecurity.SecurityTagLib.sec:ifSwitched. The former will take precedence.
2019-08-16 13:36:15.560  INFO 496 --- [ost-startStop-1] o.g.c.a.gsp.TagLibArtefactHandler        : There are conflicting tags: org.grails.plugin.springsecurity.saml.SamlTagLib.sec:loggedInUserInfo vs. grails.plugin.springsecurity.SecurityTagLib.sec:loggedInUserInfo. The former will take precedence.
2019-08-16 13:36:15.561  INFO 496 --- [ost-startStop-1] o.g.c.a.gsp.TagLibArtefactHandler        : There are conflicting tags: org.grails.plugin.springsecurity.saml.SamlTagLib.sec:ifAllGranted vs. grails.plugin.springsecurity.SecurityTagLib.sec:ifAllGranted. The former will take precedence.
2019-08-16 13:36:15.561  INFO 496 --- [ost-startStop-1] o.g.c.a.gsp.TagLibArtefactHandler        : There are conflicting tags: org.grails.plugin.springsecurity.saml.SamlTagLib.sec:ifNotSwitched vs. grails.plugin.springsecurity.SecurityTagLib.sec:ifNotSwitched. The former will take precedence.
2019-08-16 13:36:15.562  INFO 496 --- [ost-startStop-1] o.g.c.a.gsp.TagLibArtefactHandler        : There are conflicting tags: org.grails.plugin.springsecurity.saml.SamlTagLib.sec:ifNotGranted vs. grails.plugin.springsecurity.SecurityTagLib.sec:ifNotGranted. The former will take precedence.
2019-08-16 13:36:15.566  INFO 496 --- [ost-startStop-1] o.g.c.a.gsp.TagLibArtefactHandler        : There are conflicting tags: org.grails.plugin.springsecurity.saml.SamlTagLib.sec:username vs. grails.plugin.springsecurity.SecurityTagLib.sec:username. The former will take precedence.
2019-08-16 13:36:18.647  INFO 496 --- [ost-startStop-1] g.p.s.SpringSecurityCoreGrailsPlugin     :
Configuring Spring Security Core ...

Configuring Spring Security Core ...
2019-08-16 13:36:18.798  INFO 496 --- [ost-startStop-1] g.p.s.SpringSecurityCoreGrailsPlugin     : ... finished configuring Spring Security Core

... finished configuring Spring Security Core

Configuring Spring Security SAML ...
Importing beans from classpath:security/springSecuritySamlBeans.xml...
2019-08-16 13:36:18.820  INFO 496 --- [ost-startStop-1] o.s.b.f.xml.XmlBeanDefinitionReader      : Loading XML bean definitions from class path resource [security/springSecuritySamlBeans.xml]
Registering metadata key: myidp and value: security/idp-local.xml
Loading the service provider metadata from security/sp.xml...
...finished configuring Spring Security SAML

Stacktrace:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityTagLib': Invocation of init method failed; nested exception is java.lang.NullPointerException
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:137) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:407) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1623) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:124) ~[spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) ~[spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) ~[spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
        at grails.boot.GrailsApp.run(GrailsApp.groovy:84) [grails-core-3.3.9.jar:3.3.9]
        at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:156) [spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
        at org.grails.boot.context.web.GrailsAppServletInitializer.createRootApplicationContext(GrailsAppServletInitializer.groovy:57) [grails-web-boot-3.3.9.jar:3.3.9]
        at org.springframework.boot.web.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:91) [spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
        at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169) [spring-web-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154) [catalina.jar:8.5.43]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.5.43]
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743) [catalina.jar:8.5.43]
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719) [catalina.jar:8.5.43]
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714) [catalina.jar:8.5.43]
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970) [catalina.jar:8.5.43]
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1841) [catalina.jar:8.5.43]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_31]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_31]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_31]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_31]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_31]
Caused by: java.lang.NullPointerException: null
        at org.grails.taglib.TagLibraryMetaUtils.registerTagMetaMethods(TagLibraryMetaUtils.groovy:91) ~[grails-taglib-3.3.2.jar:na]
        at org.grails.taglib.TagLibraryMetaUtils.enhanceTagLibMetaClass(TagLibraryMetaUtils.groovy:25) ~[grails-taglib-3.3.2.jar:na]
        at grails.artefact.TagLibrary$Trait$Helper.initializeTagLibrary(TagLibrary.groovy:56) ~[grails-web-taglib-3.3.2.jar:3.3.9]
        at grails.artefact.TagLibrary$Trait$Helper$initializeTagLibrary.call(Unknown Source) ~[na:na]
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) ~[groovy-2.4.15.jar:2.4.15]
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) ~[groovy-2.4.15.jar:2.4.15]
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128) ~[groovy-2.4.15.jar:2.4.15]
        at org.grails.plugin.springsecurity.saml.SamlTagLib.initializeTagLibrary(SamlTagLib.groovy) ~[spring-security-saml-4.0.0.jar:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_31]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_31]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_31]
        at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_31]
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:311) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:134) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
        ... 32 common frames omitted