Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails 2.3 - run-app not working

I am getting error while running my Grails app.

My application working in Grails 2.1.4.

I am using

Groovy 2.1.*
Java 1.7
Tomcat 7.0.37

I upgraded my application from Grails 2.1.4 to 2.3.0.M1. After I am getting some error like this:

| 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)
like image 251
Sun Avatar asked May 28 '13 10:05

Sun


3 Answers

I have answered to a similar question at How to migrate Grails 2.1 to Grails 2.3 application . As a summary, compare Config.groovy & BuildConfig.groovy to the default versions of a new Grails 2.3 app. Make sure your dependencies are in BuildConfig.groovy instead of application.properties and that Tomcat, Hibernate and Scaffolding plugins are correct version and have correct scope (build for Tomcat plugin, runtime for Hibernate).

like image 189
Lari Hotari Avatar answered Nov 11 '22 13:11

Lari Hotari


I saw this line in the error log :

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

Try to comment-out section grails.project.fork of BuildConfig.groovy

like image 43
Phat H. VU Avatar answered Nov 11 '22 12:11

Phat H. VU


I had the same error and the problem was a letter case difference between the file name and the class name in the code. Make sure your class name and file name match exactly.

For instance I had my file name as OAuthCallBackController.groovy and the class name as OauthCallBackController (notice the lower case 'a')

like image 1
Lostlinkpr Avatar answered Nov 11 '22 13:11

Lostlinkpr