grails app不会在tomcat上启动

时间:2013-11-07 09:41:16

标签: grails tomcat7

我的grails应用程序在localhost上进行调试时工作正常。在'war'之后并在tomcat上部署它,它不会从以下错误开始:

Nov 07, 2013 10:41:18 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://www.springframework.org/tags is already defined
2013-11-07 10:41:22,136 [http-bio-8080-exec-84] 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 parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
    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:724)
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
    ... 3 more
Caused by: java.lang.reflect.InvocationTargetException
    ... 3 more
Caused by: java.lang.NoClassDefFoundError: org/json/simple/JSONObject
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
    at java.lang.Class.getDeclaredMethods(Class.java:1845)
    ... 3 more
Caused by: java.lang.ClassNotFoundException: org.json.simple.JSONObject
    ... 5 more
2013-11-07 10:41:22,143 [http-bio-8080-exec-84] ERROR context.GrailsContextLoader  - Error initializing the application: 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 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 parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
    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:724)
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
    ... 3 more
Caused by: java.lang.reflect.InvocationTargetException
    ... 3 more
Caused by: java.lang.NoClassDefFoundError: org/json/simple/JSONObject
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
    at java.lang.Class.getDeclaredMethods(Class.java:1845)
    ... 3 more
Caused by: java.lang.ClassNotFoundException: org.json.simple.JSONObject
    ... 5 more
2013-11-07 10:41:22,144 [http-bio-8080-exec-84] ERROR context.GrailsContextLoader  - Error initializing Grails: 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 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 parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
    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:724)
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
    ... 3 more
Caused by: java.lang.reflect.InvocationTargetException
    ... 3 more
Caused by: java.lang.NoClassDefFoundError: org/json/simple/JSONObject
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
    at java.lang.Class.getDeclaredMethods(Class.java:1845)
    ... 3 more
Caused by: java.lang.ClassNotFoundException: org.json.simple.JSONObject
    ... 5 more
Nov 07, 2013 10:41:22 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Nov 07, 2013 10:41:22 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/hyperdrive_test] startup failed due to previous errors

这个tomcat上还有另一个grails应用程序,几乎相同的配置工作正常。它错过了一些图书馆吗?

====编辑:grailsConfig.groovy ======

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/hyperdrive_test.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'
    checksums true // Whether to verify checksums on resolve
    legacyResolve false

    repositories {
        inherits true // Whether to inherit repository definitions from plugins
        grailsPlugins()
        grailsHome()
        grailsCentral()
        mavenCentral()

        // uncomment these 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 {
        // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
        runtime "postgresql:postgresql:9.1-901.jdbc4"
        // runtime 'mysql:mysql-connector-java:5.1.16'
    }

    plugins {
        runtime ":hibernate:$grailsVersion"
        runtime ":jquery:1.7.1"
        runtime ":resources:1.1.6"
        runtime ":database-migration:1.3.2"

        // Uncomment these (or add new ones) to enable additional resources capabilities
        //runtime ":zipped-resources:1.0"
        //runtime ":cached-resources:1.0"
        //runtime ":yui-minify-resources:0.1.4"
        build ":tomcat:$grailsVersion"
    }
}

===== Edit2:输出diff dir1 dir2 =========

> activation-1.1.jar
17c18
< concurrentlinkedhashmap-lru-1.2_jdk5.jar
---
> concurrentlinkedhashmap-lru-1.3.1.jar
20,46c21,47
< grails-bootstrap-2.2.0.jar
< grails-core-2.2.0.jar
< grails-crud-2.2.0.jar
< grails-datastore-core-1.1.2.RELEASE.jar
< grails-datastore-gorm-1.1.2.RELEASE.jar
< grails-datastore-simple-1.1.2.RELEASE.jar
< grails-hibernate-2.2.0.jar
< grails-logging-2.2.0.jar
< grails-plugin-codecs-2.2.0.jar
< grails-plugin-controllers-2.2.0.jar
< grails-plugin-converters-2.2.0.jar
< grails-plugin-datasource-2.2.0.jar
< grails-plugin-domain-class-2.2.0.jar
< grails-plugin-filters-2.2.0.jar
< grails-plugin-gsp-2.2.0.jar
< grails-plugin-i18n-2.2.0.jar
< grails-plugin-log4j-2.2.0.jar
< grails-plugin-mimetypes-2.2.0.jar
< grails-plugin-scaffolding-2.2.0.jar
< grails-plugin-services-2.2.0.jar
< grails-plugin-servlets-2.2.0.jar
< grails-plugin-url-mappings-2.2.0.jar
< grails-plugin-validation-2.2.0.jar
< grails-resources-2.2.0.jar
< grails-spring-2.2.0.jar
< grails-web-2.2.0.jar
< groovy-all-2.0.5.jar
---
> grails-bootstrap-2.2.3.jar
> grails-core-2.2.3.jar
> grails-crud-2.2.3.jar
> grails-datastore-core-1.1.8.RELEASE.jar
> grails-datastore-gorm-1.1.8.RELEASE.jar
> grails-datastore-simple-1.1.8.RELEASE.jar
> grails-hibernate-2.2.3.jar
> grails-logging-2.2.3.jar
> grails-plugin-codecs-2.2.3.jar
> grails-plugin-controllers-2.2.3.jar
> grails-plugin-converters-2.2.3.jar
> grails-plugin-datasource-2.2.3.jar
> grails-plugin-domain-class-2.2.3.jar
> grails-plugin-filters-2.2.3.jar
> grails-plugin-gsp-2.2.3.jar
> grails-plugin-i18n-2.2.3.jar
> grails-plugin-log4j-2.2.3.jar
> grails-plugin-mimetypes-2.2.3.jar
> grails-plugin-scaffolding-2.2.3.jar
> grails-plugin-services-2.2.3.jar
> grails-plugin-servlets-2.2.3.jar
> grails-plugin-url-mappings-2.2.3.jar
> grails-plugin-validation-2.2.3.jar
> grails-resources-2.2.3.jar
> grails-spring-2.2.3.jar
> grails-web-2.2.3.jar
> groovy-all-2.0.8.jar
59a61
> mail-1.4.3.jar
60a63
> postgresql-8.2-507.jdbc3.jar
64,77c67,83
< spring-aop-3.1.2.RELEASE.jar
< spring-asm-3.1.2.RELEASE.jar
< spring-aspects-3.1.2.RELEASE.jar
< spring-beans-3.1.2.RELEASE.jar
< spring-context-3.1.2.RELEASE.jar
< spring-context-support-3.1.2.RELEASE.jar
< spring-core-3.1.2.RELEASE.jar
< spring-expression-3.1.2.RELEASE.jar
< spring-jdbc-3.1.2.RELEASE.jar
< spring-jms-3.1.2.RELEASE.jar
< spring-orm-3.1.2.RELEASE.jar
< spring-tx-3.1.2.RELEASE.jar
< spring-web-3.1.2.RELEASE.jar
< spring-webmvc-3.1.2.RELEASE.jar
---
> spring-aop-3.1.4.RELEASE.jar
> spring-asm-3.1.4.RELEASE.jar
> spring-aspects-3.1.4.RELEASE.jar
> spring-beans-3.1.4.RELEASE.jar
> spring-context-3.1.4.RELEASE.jar
> spring-context-support-3.1.4.RELEASE.jar
> spring-core-3.1.4.RELEASE.jar
> spring-expression-3.1.4.RELEASE.jar
> spring-jdbc-3.1.4.RELEASE.jar
> spring-jms-3.1.4.RELEASE.jar
> spring-orm-3.1.4.RELEASE.jar
> spring-security-core-3.2.0.RC1.jar
> spring-security-web-3.2.0.RC1.jar
> spring-test-3.1.0.RELEASE.jar
> spring-tx-3.1.4.RELEASE.jar
> spring-web-3.1.4.RELEASE.jar
> spring-webmvc-3.1.4.RELEASE.jar

由于

1 个答案:

答案 0 :(得分:1)

你似乎错过了JSON Simple库,它正在你的应用程序的某个地方使用 - 也许它是其他库的传递依赖。

尝试添加:

compile 'org.json-simple:json-simple:1.1.1'

BuildConfig.groovy区块中的dependencies

您也可以尝试查看grails dependency-report的输出。