移动到新的 spring 后无法启动服务器 启动 Tomcat 上下文时出错



最近,我不得不将我的项目升级到最新的Grails,Gradle,Groovy,并且遇到了很多问题。 目前,我在启动 Tomcat 时遇到了这个特殊问题:

2020-06-07 17:23:22.919 ERROR --- [           main] o.s.b.web.embedded.tomcat.TomcatStarter  : Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'authenticationProcessingFilterDeregistrationBean': Cannot resolve reference to bean 'authenticationProcessingFilter' while setting bean property 'filter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationProcessingFilter': Cannot resolve reference to bean 'authenticationManager' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationManager': Cannot resolve reference to bean 'daoAuthenticationProvider' while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoAuthenticationProvider': Cannot resolve reference to bean 'userDetailsService' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDetailsService': Unsatisfied dependency expressed through method 'setTargetDatastore' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastore': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.NullPointerException: Cannot invoke method call() on null object
2020-06-07 17:23:22.958 ERROR --- [           main] o.s.boot.SpringApplication               : Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat

我搜索了应该有效的Spring和Grails的所有可能组合,但我找不到到底有什么不起作用。

我的依赖项是:

dependencies {
// added the new way using Log4j2, yes, spring makes it easy
compile "org.springframework.boot:spring-boot-starter-log4j2"
// changed spring-boot-autoconfigure so that it would not
// pull in the logback binding/implementation
compile ('org.springframework.boot:spring-boot-autoconfigure') {
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
compile ('org.springframework.boot:spring-boot-starter') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
//
compile group: 'org.springframework.security', name: 'spring-security-core', version: '5.3.2.RELEASE'
compile group: 'org.springframework.security', name: 'spring-security-web', version: '5.3.2.RELEASE'

// and finally, added the log4j2 binding/implementation
compile "org.apache.logging.log4j:log4j-api:2.13.2"
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.13.2'
//    compile "org.springframework.boot:spring-boot-starter-logging"
//    compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-web-boot"
compile "org.grails:grails-logging"
compile "org.grails:grails-plugin-rest"
compile "org.grails:grails-plugin-databinding"
compile "org.grails:grails-plugin-i18n"
compile "org.grails:grails-plugin-services"
compile "org.grails:grails-plugin-url-mappings"
compile "org.grails:grails-plugin-interceptors"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:async"
compile "org.grails.plugins:scaffolding"
compile "org.grails.plugins:events"
compile "org.grails.plugins:hibernate5"
compile "org.hibernate:hibernate-core:5.1.10.Final"
compile "org.grails.plugins:gsp"
compile 'org.grails.plugins:spring-security-core:4.0.0'
compile 'org.grails.plugins:mail:2.0.0'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.9.1'
console "org.grails:grails-console"
profile "org.grails.profiles:web"
runtime "org.glassfish.web:el-impl:2.1.2-b03"
runtime "org.apache.tomcat:tomcat-jdbc"
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.14.2"
runtime 'mysql:mysql-connector-java:5.1.29'
testCompile "org.grails:grails-gorm-testing-support"
testCompile "org.grails.plugins:geb"
testCompile "org.grails:grails-web-testing-support"
testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
}dependencies {
// added the new way using Log4j2, yes, spring makes it easy
compile "org.springframework.boot:spring-boot-starter-log4j2"
// changed spring-boot-autoconfigure so that it would not
// pull in the logback binding/implementation
compile ('org.springframework.boot:spring-boot-autoconfigure') {
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
compile ('org.springframework.boot:spring-boot-starter') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
//
compile group: 'org.springframework.security', name: 'spring-security-core', version: '5.3.2.RELEASE'
compile group: 'org.springframework.security', name: 'spring-security-web', version: '5.3.2.RELEASE'

// and finally, added the log4j2 binding/implementation
compile "org.apache.logging.log4j:log4j-api:2.13.2"
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.13.2'
//    compile "org.springframework.boot:spring-boot-starter-logging"
//    compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-web-boot"
compile "org.grails:grails-logging"
compile "org.grails:grails-plugin-rest"
compile "org.grails:grails-plugin-databinding"
compile "org.grails:grails-plugin-i18n"
compile "org.grails:grails-plugin-services"
compile "org.grails:grails-plugin-url-mappings"
compile "org.grails:grails-plugin-interceptors"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:async"
compile "org.grails.plugins:scaffolding"
compile "org.grails.plugins:events"
compile "org.grails.plugins:hibernate5"
compile "org.hibernate:hibernate-core:5.1.10.Final"
compile "org.grails.plugins:gsp"
compile 'org.grails.plugins:spring-security-core:4.0.0'
compile 'org.grails.plugins:mail:2.0.0'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.9.1'
console "org.grails:grails-console"
profile "org.grails.profiles:web"
runtime "org.glassfish.web:el-impl:2.1.2-b03"
runtime "org.apache.tomcat:tomcat-jdbc"
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.14.2"
runtime 'mysql:mysql-connector-java:5.1.29'
testCompile "org.grails:grails-gorm-testing-support"
testCompile "org.grails.plugins:geb"
testCompile "org.grails:grails-web-testing-support"
testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
}

在升级之前,一切正常。 所有升级都是在依赖项中完成的,代码没有太多更改。仅某些密码加密。

有没有人看到过什么或知道如何解决这个问题?

谢谢

问题出在版本compile "org.hibernate:hibernate-core:5.1.10.Final"中 - 可能是有问题的,更改为compile "org.hibernate:hibernate-core:5.4.10.Final"一切正常后。

此外,一个域类具有 static mapping = { cache true } 这也不再起作用。

就我而言,我有运行时 springframework,通过编译更改它并且可以工作

runtime 'org.springframework:spring-test:4.2.1.RELEASE'

更改方式:

compile 'org.springframework:spring-test:4.2.1.RELEASE'

相关内容

  • 没有找到相关文章

最新更新