当我在 Tomcat 7 上部署我的应用程序时,我在生产 Ubuntu 和开发 iOS 上都遇到了这个奇怪的失败。奇怪......而且我找不到导致问题的确切代码/:调用$ grails run-app 工作得很好..
这是我的错误信息:
2013-03-04 16:47:27,966 [localhost-startStop-1] ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/
applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class p
arameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsC
ontrollerClass
... 6 more
Caused by: java.lang.reflect.InvocationTargetException
... 6 more
Caused by: java.lang.NoClassDefFoundError: grails/test/GrailsMock
at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
at java.lang.Class.getDeclaredMethods(Class.java:1808)
... 6 more
Caused by: java.lang.ClassNotFoundException: grails.test.GrailsMock
... 8 more
2013-03-04 16:47:27,991 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with na
me 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.
lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/
applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class p
arameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsC
ontrollerClass
... 6 more
Caused by: java.lang.reflect.InvocationTargetException
... 6 more
Caused by: java.lang.NoClassDefFoundError: grails/test/GrailsMock
at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
at java.lang.Class.getDeclaredMethods(Class.java:1808)
... 6 more
Caused by: java.lang.ClassNotFoundException: grails.test.GrailsMock
... 8 more
2013-03-04 16:47:28,003 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing Grails: Error creating bean with name 'plugi
nManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.Runt
imeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/
applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class p
arameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsC
ontrollerClass
... 6 more
Caused by: java.lang.reflect.InvocationTargetException
... 6 more
Caused by: java.lang.NoClassDefFoundError: grails/test/GrailsMock
at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
at java.lang.Class.getDeclaredMethods(Class.java:1808)
... 6 more
Caused by: java.lang.ClassNotFoundException: grails.test.GrailsMock
... 8 more
还有我的 BuildConfig:
grails.servlet.version = "2.5" // Change depending on target container compliance (2.5 or 3.0)
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") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
}
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
grailsCentral()
mavenLocal()
mavenCentral()
mavenRepo "http://repository.codehaus.org/"
mavenRepo "http://repository.jboss.org/maven2/"
// uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
//mavenRepo "http://snapshots.repository.codehaus.org"
//mavenRepo "http://repository.codehaus.org"
//mavenRepo "http://download.java.net/maven/2/"
//mavenRepo "http://repository.jboss.com/maven2/"
}
dependencies {
compile 'com.googlecode.json-simple:json-simple:1.1'
compile 'org.mongodb:mongo-java-driver:2.10.1'
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
// runtime 'mysql:mysql-connector-java:5.1.20'
}
plugins {
compile ":mongodb:1.0.0.GA"
build ":tomcat:$grailsVersion"
runtime(":hibernate:$grailsVersion") {
export = false
}
test ":build-test-data:2.0.3"
compile ":crypto:2.0"
}
}
谢谢,
阿米特。
PS:链接到我在 grails-users 列表中的问题:http: //grails.1312388.n4.nabble.com/Grails-fails-on-tomcat-with-missing-class-GrailsMock-tt4642038.html