执行grails run-app时出现以下错误,我试图在本地运行我的grails应用程序,但无法执行此操作
以下是Stacktrace的错误
2017-01-25T06:01:32.640+05:00 uptime="38155", level="ERROR", class="org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener", thread="localhost-startStop-1:", message="Error initializing the application: Error creating bean with name 'samlIDPDiscovery': Unsatisfied dependency expressed through method 'setSamlEntryPoint' parameter 0: Error creating bean with name 'samlEntryPoint': Unsatisfied dependency expressed through method 'setContextProvider' parameter 0: Error creating bean with name 'contextProvider': Cannot resolve reference to bean 'metadataResolver' while setting bean property 'metadataResolver'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metadataResolver': Initialization of bean failed; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contextProvider': Cannot resolve reference to bean 'metadataResolver' while setting bean property 'metadataResolver'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metadataResolver': Initialization of bean failed; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'samlEntryPoint': Unsatisfied dependency expressed through method 'setContextProvider' parameter 0: Error creating bean with name 'contextProvider': Cannot resolve reference to bean 'metadataResolver' while setting bean property 'metadataResolver'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metadataResolver': Initialization of bean failed; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contextProvider': Cannot resolve reference to bean 'metadataResolver' while setting bean property 'metadataResolver'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metadataResolver': Initialization of bean failed; nested exception is java.lang.NullPointerException"
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'samlIDPDiscovery': Unsatisfied dependency expressed through method 'setSamlEntryPoint' parameter 0: Error creating bean with name 'samlEntryPoint': Unsatisfied dependency expressed through method 'setContextProvider' parameter 0: Error creating bean with name 'contextProvider': Cannot resolve reference to bean 'metadataResolver' while setting bean property 'metadataResolver'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metadataResolver': Initialization of bean failed; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contextProvider': Cannot resolve reference to bean 'metadataResolver' while setting bean property 'metadataResolver'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metadataResolver': Initialization of bean failed; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'samlEntryPoint': Unsatisfied dependency expressed through method 'setContextProvider' parameter 0: Error creating bean with name 'contextProvider': Cannot resolve reference to bean 'metadataResolver' while setting bean property 'metadataResolver'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metadataResolver': Initialization of bean failed; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contextProvider': Cannot resolve reference to bean 'metadataResolver' while setting bean property 'metadataResolver'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metadataResolver': Initialization of bean failed; nested exception is java.lang.NullPointerException
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'samlEntryPoint': Unsatisfied dependency expressed through method 'setContextProvider' parameter 0: Error creating bean with name 'contextProvider': Cannot resolve reference to bean 'metadataResolver' while setting bean property 'metadataResolver'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metadataResolver': Initialization of bean failed; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contextProvider': Cannot resolve reference to bean 'metadataResolver' while setting bean property 'metadataResolver'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metadataResolver': Initialization of bean failed; nested exception is java.lang.NullPointerException
... 4 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contextProvider': Cannot resolve reference to bean 'metadataResolver' while setting bean property 'metadataResolver'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metadataResolver': Initialization of bean failed; nested exception is java.lang.NullPointerException
... 4 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metadataResolver': Initialization of bean failed; nested exception is java.lang.NullPointerException
... 4 more
Caused by: java.lang.NullPointerException
... 4 more
security {
saml {
userAttributeMappings = ['firstName': 'FirstName', 'lastName': 'LastName', 'email': 'EmailAddress']
userGroupToRoleMapping = [:]
active = true
afterLoginUrl = '/'
afterLogoutUrl = '/'
loginFormUrl = '/saml/login'
userGroupAttribute = "memberOf"
responseSkew = 60
idpSelectionPath = '/'
autoCreate {
active = true
key = 'username'
assignAuthorities = true
}
metadata {
defaultIdp = 'http://idp.ssocircle.com'
url = '/saml/metadata'
//default idp info
idp{
file = 'security/idp.xml'
alias = 'http://idp.ssocircle.com'
}
sp {
file = 'security/sp.xml'
alias = 'jbilling'
defaults{
local = true
alias = 'jbilling'
signingKey = 'ping'
encryptionKey = 'ping'
tlsKey = 'ping'
requireArtifactResolveSigned = false
requireLogoutRequestSigned = false
requireLogoutResponseSigned = false
idpDiscoveryEnabled = true
}
}
}
keyManager {
storeFile = 'classpath:security/keystore.jks'
storePass = 'nalle123'
passwords = [ ping: 'ping123' ]
defaultKey = 'ping'
}
}
}
def conf = SpringSecurityUtils.securityConfig
if (!conf || !conf.active) { return }
SpringSecurityUtils.loadSecondaryConfig 'SamlSecurityConfig'
conf = SpringSecurityUtils.securityConfig
if (!conf.saml.active) { return }
println 'Configuring Spring Security SAML ...'
//Due to Spring DSL limitations, need to import these beans as XML definitions
def beansFile = "classpath:security/springSecuritySamlBeans.xml"
delegate.importBeans beansFile
xmlns context:"http://www.springframework.org/schema/context"
context.'annotation-config'()
context.'component-scan'('base-package': "org.springframework.security.saml")
SpringSecurityUtils.registerProvider 'samlAuthenticationProvider'
SpringSecurityUtils.registerLogoutHandler 'successLogoutHandler'
SpringSecurityUtils.registerLogoutHandler 'logoutHandler'
successRedirectHandler(SavedRequestAwareAuthenticationSuccessHandler) {
alwaysUseDefaultTargetUrl = conf.saml.alwaysUseAfterLoginUrl ?: false
defaultTargetUrl = conf.saml.afterLoginUrl
}
successLogoutHandler(SimpleUrlLogoutSuccessHandler) {
defaultTargetUrl = conf.saml.afterLogoutUrl
}
samlLogger(SAMLDefaultLogger)
keyManager(JKSKeyManager,
conf.saml.keyManager.storeFile, conf.saml.keyManager.storePass, conf.saml.keyManager.passwords, conf.saml.keyManager.defaultKey)
samlEntryPoint(SAMLEntryPoint) {
println "Entry point process url is ${conf.saml.loginFormUrl}"
filterProcessesUrl = conf.saml.loginFormUrl // '/saml/login'
defaultProfileOptions = ref('webProfileOptions')
}
webProfileOptions(WebSSOProfileOptions) {
includeScoping = false
}
// metadataFilter(MetadataDisplayFilter) {
// println "metadataFilter process url: ${conf.saml.metadata.url }"
// filterProcessesUrl = conf.saml.metadata.url //'/saml/metadata'
// }
//
metadataGenerator(MetadataGenerator) {
includeDiscoveryExtension = true
}
metadataGeneratorFilter(MetadataGeneratorFilter, ref('metadataGenerator'))
log.debug "Defining the default idp metadata provider... "
def idpResource
def idpFile = conf.saml.metadata.idp.file
if(idpFile){
idpResource = new ClassPathResource(idpFile)
defaultIdpMetadata(ExtendedMetadataDelegate) { extMetaDataDelegateBean ->
idpMetadataProvider(FilesystemMetadataProvider) { bean ->
bean.constructorArgs = [idpResource.getFile()]
parserPool = ref('parserPool')
}
extMetaDataDelegateBean.constructorArgs = [ref('idpMetadataProvider')]
}
}
def spFile = conf.saml.metadata.sp.file
if (spFile) {
def spResource = new ClassPathResource(spFile)
spMetadata(ExtendedMetadataDelegate) { spMetadataBean ->
spMetadataProvider(FilesystemMetadataProvider) { spMetadataProviderBean ->
spMetadataProviderBean.constructorArgs = [spResource.getFile()]
parserPool = ref('parserPool')
}
def spDefaults = conf.saml.metadata.sp.defaults
spMetadataDefaults(ExtendedMetadata) { extMetadata ->
local = spDefaults.local
alias = spDefaults.alias
signingKey = spDefaults.signingKey
encryptionKey = spDefaults.encryptionKey
tlsKey = spDefaults.tlsKey
requireArtifactResolveSigned = spDefaults.requireArtifactResolveSigned
requireLogoutRequestSigned = spDefaults.requireLogoutRequestSigned
requireLogoutResponseSigned = spDefaults.requireLogoutResponseSigned
idpDiscoveryEnabled = spDefaults.idpDiscoveryEnabled
}
spMetadataBean.constructorArgs = [ref('spMetadataProvider'), ref('spMetadataDefaults')]
}
}
metadata(CachingMetadataManager,[ref('spMetadata'), ref('defaultIdpMetadata')]){
hostedSPName = conf.saml.metadata.sp?."alias"
defaultIDP = conf.saml.metadata.defaultIdp
}
samlUserDetailsService(SpringSamlUserDetailsService) {
grailsApplication = ref('grailsApplication')
authorityClassName = conf.authority.className
authorityJoinClassName = conf.userLookup.authorityJoinClassName
authorityNameField = conf.authority.nameField
samlAutoCreateActive = conf.saml.autoCreate.active
samlAutoAssignAuthorities = conf.saml.autoCreate.assignAuthorities
samlAutoCreateKey = conf.saml.autoCreate.key
samlUserAttributeMappings = conf.saml.userAttributeMappings
samlUserGroupAttribute = conf.saml.userGroupAttribute
samlUserGroupToRoleMapping = conf.saml.userGroupToRoleMapping
userDomainClassName = conf.userLookup.userDomainClassName
}
samlAuthenticationProvider(GrailsSAMLAuthenticationProvider) {
userDetails = ref('samlUserDetailsService')
hokConsumer = ref('webSSOprofileConsumer')
}
metadataResolver(MetadataCredentialResolver,ref('metadata'),ref('keyManager')) {
useXmlMetadata = true
}
contextProvider(SAMLContextProviderImpl) {
metadataResolver = ref('metadataResolver')
}
samlProcessingFilter(SAMLProcessingFilter) {
authenticationManager = ref('authenticationManager')
authenticationSuccessHandler = ref('successRedirectHandler')
sessionAuthenticationStrategy = ref('sessionFixationProtectionStrategy')
authenticationFailureHandler = ref('authenticationFailureHandler')
}
authenticationFailureHandler(AjaxAwareAuthenticationFailureHandler) {
redirectStrategy = ref('redirectStrategy')
defaultFailureUrl = conf.failureHandler.defaultFailureUrl //'/login/authfail?login_error=1'
useForward = conf.failureHandler.useForward // false
ajaxAuthenticationFailureUrl = conf.failureHandler.ajaxAuthFailUrl // '/login/authfail?ajax=true'
exceptionMappings = conf.failureHandler.exceptionMappings // [:]
}
redirectStrategy(DefaultRedirectStrategy) {
contextRelative = conf.redirectStrategy.contextRelative // false
}
sessionFixationProtectionStrategy(SessionFixationProtectionStrategy)
logoutHandler(SecurityContextLogoutHandler) {
invalidateHttpSession = true
}
samlLogoutFilter(SAMLLogoutFilter,
ref('successLogoutHandler'), ref('logoutHandler'), ref('logoutHandler'))
samlLogoutProcessingFilter(SAMLLogoutProcessingFilter,
ref('successLogoutHandler'), ref('logoutHandler'))
webSSOprofileConsumer(WebSSOProfileConsumerImpl){
responseSkew = conf.saml.responseSkew
}
webSSOprofile(WebSSOProfileImpl)
ecpprofile(WebSSOProfileECPImpl)
logoutprofile(SingleLogoutProfileImpl)
postBinding(HTTPPostBinding, ref('parserPool'), ref('velocityEngine'))
redirectBinding(HTTPRedirectDeflateBinding, ref('parserPool'))
artifactBinding(HTTPArtifactBinding,
ref('parserPool'),
ref('velocityEngine'),
ref('artifactResolutionProfile')
)
artifactResolutionProfile(ArtifactResolutionProfileImpl, ref('httpClient')) {
processor = ref('soapProcessor')
}
httpClient(HttpClient)
soapProcessor(SAMLProcessorImpl, ref('soapBinding'))
soapBinding(HTTPSOAP11Binding, ref('parserPool'))
paosBinding(HTTPPAOS11Binding, ref('parserPool'))
bootStrap(SAMLBootstrap)
velocityEngine(VelocityFactory) { bean ->
bean.factoryMethod = "getEngine"
}
parserPool(BasicParserPool)
securityTagLib(SamlTagLib) {
springSecurityService = ref('samlSpringSecurityService')
webExpressionHandler = ref('webExpressionHandler')
webInvocationPrivilegeEvaluator = ref('webInvocationPrivilegeEvaluator')
}
samlSpringSecurityService(SamlSecurityService) {
config = conf
authenticationTrustResolver = ref('authenticationTrustResolver')
grailsApplication = ref('grailsApplication')
passwordEncoder = ref('passwordEncoder')
objectDefinitionSource = ref('objectDefinitionSource')
userDetailsService = ref('userDetailsService')
userCache = ref('userCache')
}
println '...finished configuring Spring Security SAML'
我已在此处添加了完整的堆栈跟踪http://pasted.co/97aa6cb4,如果您发现问题,请查看并告知我们 如果你愿意,我可以提供更多细节,任何人都可以帮助解决这个问题的原因吗?以及如何解决这个问题?
答案 0 :(得分:0)
尝试在JKSKeyManager的构造函数中指定第一个参数,该构造函数是org.springframework.core.io.Resource,看起来最适合您的配置值的实现是org.springframework.core.io。使用ClassPathResource。
cpResource(ClassPathResource, conf.saml.keyManager.storeFile )
keyManager(JKSKeyManager,
ref('cpResource'),
conf.saml.keyManager.storePass,
conf.saml.keyManager.passwords,
conf.saml.keyManager.defaultKey)