创建名称为 'securityTagLib' 的 bean 时出错 - (grails-spring-security-saml 插件)

Error creating bean with name 'securityTagLib' - (grails-spring-security-saml plugin)

我们目前正在使用 PingFederate 和 SAML 实施 SSO。在这个过程中我们也从Grails 2.4.4升级到Grails 3.3.9.

我们在开发中没有遇到任何问题,但是在 tomcat 上部署我们项目的 war 文件时,我们似乎在 SAML 插件和 spring-security-core,特别是在下面的堆栈跟踪中看到的 SamlTagLib 和 SecurityTagLib。

如果没有 saml 插件,则不会出现此问题。

如果有人能提供任何信息来说明为什么会发生这种情况,我们将不胜感激and/or解决此问题的方法。

我们的构建文件具有以下依赖项;

   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"

堆栈跟踪:

        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.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

构建过程中缺少依赖项。

将以下内容添加到 build.gradle 文件:

dependencies {
    ...
    compile "org.grails.plugins:gsp:4.0.0"
}

apply plugin:"org.grails.grails-gsp"