-1

Tomcat 7にアプリをデプロイするときに、本番Ubuntuと開発iOSの両方でこの奇妙な失敗が発生します。奇妙な...そして、問題を引き起こすコードの正確な部分が見つかりません/: Calling $ 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

4

2 に答える 2

1

問題は、サービスの 1 つの上部にある @Mock アノテーションを参照していたことです。@Mock アノテーションは明らかにそこに属していませんが、テストクラスに属しています。これにより、.war パッケージから解決できなかった Grails のテスト パッケージへの参照が作成されました。

私はおそらくTDDをしている間にそれを混同した/:

于 2013-03-06T09:25:00.260 に答える
0

欠落しているクラスは grails-test-2.1.1.jar にあります (バージョンに合わせて 2.1.1 を調整してください)。

そのjarファイルをデプロイしたことを確認してください。

または、Grails Console プラグインを使用してクラスパスを調べることもできます。

于 2013-03-05T06:01:47.253 に答える