我需要将我的应用程序从2.2.1 grails升级到2.3.6(2.3.7与mongodb有一些错误)。 升级后我得到了如下错误:
java.lang.NoClassDefFoundError: org/springframework/jmx/support/RegistrationPolicy
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getDeclaredMethods(Class.java:1855)
at org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:161)
at org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:106)
at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:87)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:233)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:203)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:622)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451)
at org.codehaus.groovy.grails.commons.spring.DefaultRuntimeSpringConfiguration.getApplicationContext(DefaultRuntimeSpringConfiguration.java:156)
at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:169)
at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:127)
at org.codehaus.groovy.grails.web.context.GrailsConfigUtils.configureWebApplicationContext(GrailsConfigUtils.java:122)
at org.codehaus.groovy.grails.web.context.GrailsContextLoader.initWebApplicationContext(GrailsContextLoader.java:108)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.springframework.jmx.support.RegistrationPolicy
at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:175)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:147)
at org.codehaus.groovy.grails.cli.support.GrailsRootLoader.loadClass(GrailsRootLoader.java:51)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
我的BuildConfig.groovy看起来像:
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
compile "org.jadira.usertype:usertype.jodatime:1.9"
compile "org.im4java:im4java:1.2.0"
compile "org.apache.commons:commons-lang3:3.3.2"
compile "com.googlecode.json-simple:json-simple:1.1.1"
compile "com.rabbitmq:amqp-client:3.1.3"
compile ("org.springframework.amqp:spring-rabbit:1.2.1.RELEASE") {
excludes "amqp-client"
}
compile 'org.activiti:activiti-engine:5.12.1'
compile 'org.activiti:activiti-spring:5.12.1'
compile ('org.activiti:activiti-rest:5.12.1'){
excludes 'slf4j-api'
excludes 'slf4j-log4j'
excludes 'slf4j-log4j12'
}
compile 'org.activiti:activiti-modeler:5.12.1'
compile 'org.activiti:activiti-bpmn-converter:5.12.1'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
compile 'org.elasticsearch:elasticsearch-lang-groovy:2.0.0'
compile 'com.itextpdf:itextpdf:5.0.6'
compile 'org.springframework.integration:spring-integration-http:2.2.1.RELEASE'
compile 'pl.fissst:fis-bps-api:1.0.0'
compile "net.sf.ehcache:ehcache-core:2.4.6"
//--------------------
runtime 'org.postgresql:postgresql:9.3-1101-jdbc41'
runtime "org.apache.pdfbox:pdfbox:1.8.4"
runtime 'org.elasticsearch:elasticsearch:1.0.0'
runtime 'com.vividsolutions:jts:1.13'
runtime 'org.apache.httpcomponents:httpclient:4.3.3'
runtime 'org.jsoup:jsoup:1.7.3'
//---------------------
test "xmlunit:xmlunit:1.4"
test "org.spockframework:spock-grails-support:0.7-groovy-2.0"
test "org.gebish:geb-spock:$gebVersion"
test "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
//---------------------
//provided 'cglib:cglib:3.1' // uncomment to enable java-melody support
}
plugins {
build ":tomcat:7.0.52.1"
build ':release:3.0.1'
build (':rest-client-builder:2.0.1'){
export = false
}
//------------------
compile ':jmx:0.9'
compile (":mail:1.0.4") {
excludes 'spring-test'
}
compile ":joda-time:1.4"
compile ":csv:0.3.1"
compile ':mongodb:2.0.1'
compile ':fixtures:1.2'
compile ':build-test-data:2.1.2'
compile ':teamcity:1.0.3'
compile ':transaction-handling:0.1.3'
compile ':plugin-config:0.2.0'
compile ":rest:0.8"
compile(':excel-export:0.2.1') {
excludes "xercesImpl"
}
compile ':spring-security-core:2.0-RC2'
compile ":spring-security-oauth2-provider:1.0.5.2"
compile ':webxml:1.4.1'
//----------------
runtime ":hibernate:3.6.10.10"
runtime ':executor:0.3'
//runtime ':hibernate4:4.3.4.2'
runtime ':database-migration:1.4.0'
runtime ':quartz:1.0.1'
runtime ":resources:1.2.7"
runtime (":activiti:5.12.1") {
excludes 'org.activiti:activiti-engine:5.12.1'
excludes 'org.activiti:activiti-spring:5.12.1'
}
// runtime ':grails-melody:1.48.0-fis'
//-----------------
test ':code-coverage:1.2.7'
test ":geb:$gebVersion"
test ":cucumber:0.9.0"
}
有人有任何想法解决这个问题吗?
答案 0 :(得分:0)
Grails 2.2.1基于Spring 3.1.2,而Grails 2.3.6基于Spring 3.2.8。无法找到的类是org.springframework.jmx.support.RegistrationPolicy
,并且自3.2起就是Spring的一部分
这可能意味着您的某个依赖项或插件依赖于旧版本的Spring与Grails提供的版本冲突。找到它的最佳方法是运行dependency report,找到此依赖项并将其排除。您应该查看有关dependency resolution的Grails文档部分以获取更多详细信息。