我正在将我的grails应用程序从2.1.1版升级到2.4.3但我收到的错误信息如下:
| Compiling 405 source files.
| Error Compilation error: startup failed:
General error during conversion: java.lang.NoClassDefFoundError: org/springframework/aop/framework/AopInfrastructureBean
java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/springframework/aop/framework/AopInfrastructureBean
at org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1083)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1061)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:583)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:561)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:538)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:517)
at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:59)
at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:215)
at org.codehaus.groovy.ant.Groovyc.runCompiler(Groovyc.java:1161)
at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:1212)
at org.codehaus.groovy.grails.compiler.Grailsc.compile(Grailsc.java:78)
at org.codehaus.groovy.ant.Groovyc.execute(Groovyc.java:827)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at groovy.util.AntBuilder.performTask(AntBuilder.java:319)
at groovy.util.AntBuilder.nodeCompleted(AntBuilder.java:264)
at groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:147)
at groovy.util.AntBuilder.doInvokeMethod(AntBuilder.java:203)
at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:64)
at org.codehaus.gant.GantBuilder.invokeMethod(GantBuilder.java:99)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
...
...
...
...
...
org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit$1.call(JavaAwareCompilationUnit.java:67)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1047)
... 565 more
Caused by: java.lang.ClassNotFoundException: org.springframework.aop.framework.AopInfrastructureBean
at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:175)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
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:357)
... 589 more
1 error
构建配置文件:
grails.servlet.version = "2.5"
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.target.level = 1.6
grails.project.source.level = 1.6
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment to disable ehcache
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
repositories {
inherits true
grailsPlugins()
grailsHome()
grailsCentral()
// uncomment the below to enable remote dependency resolution
// from public Maven repositories
mavenLocal()
mavenCentral()
//mavenRepo "http://snapshots.repository.codehaus.org"
//mavenRepo "http://repository.codehaus.org"
mavenRepo "http://download.java.net/maven/2/"
//mavenRepo "http://repository.jboss.com/maven2/"
mavenRepo "http://repository.springsource.com/maven/bundles/release"
mavenRepo "http://repository.springsource.com/maven/bundles/external"
}
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
runtime 'mysql:mysql-connector-java:5.1.20'
compile "javax.mail:mail:1.4.3"
runtime "org.springframework:spring-test:4.0.6.RELEASE"
}
plugins {
runtime ":hibernate4:4.3.5.5" // or ":hibernate:3.6.10.17"
runtime ":jquery:1.8.0"
runtime ":resources:1.1.6"
build ":tomcat:7.0.55"
runtime ":database-migration:1.4.0"
compile ":cache:1.1.8"
compile ":mail:1.0.7"
compile ":spring-security-core:2.0-RC4"
compile ":searchable:0.6.9"
compile ":yui:2.8.2.1"
}
}
我几乎将大多数插件更新到最新版本,例如:spring-security-core:2.0-RC4
我还在grails的官方jira中发现了一个问题,它描述了与我相同的问题: https://jira.grails.org/browse/GPSPRINGSECURITYUI-62
我不知道它是否仍然是一个尚未解决的错误?
答案 0 :(得分:2)
由于您的BuidConfig.groovy不包含grails.project.dependency.resolver =' maven'我认为Grails可以追溯到古老的常春藤#39。 我遇到了ame问题,必须手动提供这2个依赖项才能解决此问题:https://jira.grails.org/browse/GRAILS-11184
编译' org.springframework:spring-aop:3.2.9.RELEASE' 编译' org.springframework:spring-expression:3.2.9.RELEASE'答案 1 :(得分:0)
对我来说,从Grails 2.2.4升级到Grails 2.4.2会产生类似的错误消息。
我的解决方案是添加到BuildConfig.groovy,以下"依赖"部分:
dependencies {
runtime 'org.springframework:spring-aop:4.0.5.RELEASE'
runtime 'org.springframework:spring-expression:4.0.5.RELEASE'
}