Grails2.3-运行应用程序不工作

Grails2.3-运行应用程序不工作,grails,grails-plugin,grails-2.0,grails-controller,Grails,Grails Plugin,Grails 2.0,Grails Controller,我在运行Grails应用程序时出错 我的应用程序使用Grails2.1.4 我正在使用 Groovy 2.1.* Java 1.7 Tomcat 7.0.37 我将应用程序从Grails2.1.4升级到2.3.0.M1。在我遇到这样的错误之后: | Loading Grails 2.3.0.M1 | Configuring classpath | Error SLF4J: Class path contains multiple SLF4J bindings. | Error SLF4J: F

我在运行Grails应用程序时出错

我的应用程序使用Grails2.1.4

我正在使用

Groovy 2.1.*
Java 1.7
Tomcat 7.0.37
我将应用程序从Grails2.1.4升级到2.3.0.M1。在我遇到这样的错误之后:

| Loading Grails 2.3.0.M1
| Configuring classpath
| Error SLF4J: Class path contains multiple SLF4J bindings.
| Error SLF4J: Found binding in [jar:file:/home/testuser/.m2/repository/org/grails/grails-plugin-log4j/2.3.0.M1/grails-plugin-log4j-2.3.0.M1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
| Error SLF4J: Found binding in [jar:file:/home/testuser/.m2/repository/org/slf4j/slf4j-log4j12/1.6.6/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
| Error SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
| Error SLF4J: Actual binding is of type [org.slf4j.impl.GrailsSlf4jLoggerFactory]
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application.....
| Compiling 143 source files.
Copying properties file...
| Compiling 143 source files.....
Updated web.xml for session information
| Running Grails application
/mycompany/dev/testuser/ws2/myapp\..\sub-app\deploy\dev\log4j.xml
| Running Grails application.
| Error SLF4J: Class path contains multiple SLF4J bindings.
| Error SLF4J: Found binding in [jar:file:/home/testuser/.m2/repository/org/grails/grails-plugin-log4j/2.3.0.M1/grails-plugin-log4j-2.3.0.M1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
| Error SLF4J: Found binding in [jar:file:/home/testuser/.m2/repository/org/slf4j/slf4j-log4j12/1.6.6/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
| Error SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
| Error SLF4J: Actual binding is of type [org.slf4j.impl.GrailsSlf4jLoggerFactory]
| Server running. Browse to http://localhost:8080/myapp
Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: myapp.RefreshCustomerMatrixJob
    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: org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: myapp.RefreshCustomerMatrixJob
    ... 5 more
Caused by: java.lang.ClassNotFoundException: myapp.RefreshCustomerMatrixJob
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    ... 5 more
Error initializing the application: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: myapp.RefreshCustomerMatrixJob
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: myapp.RefreshCustomerMatrixJob
    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: org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: myapp.RefreshCustomerMatrixJob
    ... 5 more
Caused by: java.lang.ClassNotFoundException: myapp.RefreshCustomerMatrixJob
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    ... 5 more
| Error Exception in thread "Thread-7" 
| Error java.lang.RuntimeException: Forked Grails VM exited with error
| Error     at org.codehaus.groovy.grails.cli.fork.ForkedGrailsProcess$_attachOutputListener_closure5.doCall(ForkedGrailsProcess.groovy:220)
| Error     at org.codehaus.groovy.grails.cli.fork.ForkedGrailsProcess$_attachOutputListener_closure5.doCall(ForkedGrailsProcess.groovy)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
| Error     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error     at java.lang.reflect.Method.invoke(Method.java:601)
| Error     at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1243)
| Error     at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
| Error     at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
| Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085)
| Error     at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
| Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
| Error     at groovy.lang.Closure.call(Closure.java:411)
| Error     at groovy.lang.Closure.call(Closure.java:405)
| Error     at org.codehaus.groovy.grails.cli.fork.ForkedGrailsProcess.attachOutputListener(ForkedGrailsProcess.groovy:228)
| Error     at org.grails.plugins.tomcat.fork.ForkedTomcatServer.attachOutputListener(ForkedTomcatServer.groovy)
| Error     at org.codehaus.groovy.grails.cli.fork.ForkedGrailsProcess.attachOutputListener(ForkedGrailsProcess.groovy)
| Error     at org.grails.plugins.tomcat.fork.ForkedTomcatServer.attachOutputListener(ForkedTomcatServer.groovy)
| Error     at org.codehaus.groovy.grails.cli.fork.ForkedGrailsProcess.fork(ForkedGrailsProcess.groovy:172)
| Error     at org.grails.plugins.tomcat.fork.ForkedTomcatServer.fork(ForkedTomcatServer.groovy)
| Error     at org.codehaus.groovy.grails.cli.fork.ForkedGrailsProcess.fork(ForkedGrailsProcess.groovy:141)
| Error     at org.grails.plugins.tomcat.fork.ForkedTomcatServer.fork(ForkedTomcatServer.groovy)
| Error     at org.grails.plugins.tomcat.fork.ForkedTomcatServer$_startSecure_closure1.doCall(ForkedTomcatServer.groovy:122)
| Error     at org.grails.plugins.tomcat.fork.ForkedTomcatServer$_startSecure_closure1.doCall(ForkedTomcatServer.groovy)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
| Error     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error     at java.lang.reflect.Method.invoke(Method.java:601)
| Error     at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1243)
| Error     at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
| Error     at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
| Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085)
| Error     at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
| Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
| Error     at groovy.lang.Closure.call(Closure.java:411)
| Error     at org.grails.plugins.tomcat.fork.ForkedTomcatServer$_startSecure_closure1.call(ForkedTomcatServer.groovy)
| Error     at groovy.lang.Closure.call(Closure.java:405)
| Error     at org.grails.plugins.tomcat.fork.ForkedTomcatServer$_startSecure_closure1.call(ForkedTomcatServer.groovy)
| Error     at groovy.lang.Closure.run(Closure.java:492)
| Error     at org.grails.plugins.tomcat.fork.ForkedTomcatServer$_startSecure_closure1.run(ForkedTomcatServer.groovy)
| Error     at java.lang.Thread.run(Thread.java:722)

我已在会议上回答了一个类似的问题。作为总结,将
Config.groovy
BuildConfig.groovy
与新Grails2.3应用程序的默认版本进行比较。确保您的依赖项位于
BuildConfig.groovy
而不是
application.properties
中,并且TomcatHibernateScaffolding插件的版本和范围正确(为Tomcat插件构建,为Hibernate运行时).

我在错误日志中看到这一行:

Error Exception in thread "Thread-7" 
| Error java.lang.RuntimeException: Forked Grails VM exited with error

尝试注释掉BuildConfig.groovygrails.project.fork部分,我遇到了相同的错误,问题是代码中的文件名和类名之间存在大小写差异。确保类名和文件名完全匹配


例如,我的文件名为OAuthCallBackController.groovy,类名为OAuthCallBackController(请注意小写字母“a”)

在我的工作区中找不到
myapp.RefreshCustomerMatrixJob
这样的文件。还有其他建议吗?这是错误的原因,不是建议。您已将应用程序配置为使用具有此类名称的bean,直到没有解决此问题的方法为止。