I'm having an issue using Grails on my machine... Java's installed, Groovy's working, but Grails always fails with a RootLoader class not found issue.
I've tried multiple Java/Groovy/Grails combinations to no effect.
Here's the entire output of my console
C:\Users\west>groovy --version
Groovy Version: 2.4.3 JVM: 1.7.0_45 Vendor: Oracle Corporation OS: Windows 7
C:\Users\west>grails --version
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/groovy/t
ools/RootLoader
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getMethod0(Class.java:2774)
at java.lang.Class.getMethod(Class.java:1663)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.tools.RootLoade
r
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more
Related
How do I build my Grails 3.3.2 app to deploy it into a Jetty 9.1.4 contained I provide (not embedded)?
I am trying to run my Grails 3.3.2 app in a Jetty (v 9.1.4) container. I added the following to my build.gradle file.
ext['jetty.version'] = '9.1.4.v20140401'
And tried several combinations of the Spring Boot container starter.
compile "org.springframework.boot:spring-boot-starter-actuator"
provided "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.springframework.boot:spring-boot-starter-jetty"
but I continue to get errors.
2018-08-15 17:07:49.375:INFO:oejs.Server:main: jetty-9.1.4.v20140401
2018-08-15 17:07:51.722:WARN:oejj.ObjectMBean:main:
java.lang.NoClassDefFoundError: org/eclipse/jetty/jmx/ObjectMBean
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:427)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:389)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
I can run the app when embedding Jetty or Tomcat but not from my container.
I build the war from my project as follows.
grails war
2 things.
You are missing jetty-jmx-<version>.jar dependency for that NoClassDefFoundError.
Jetty 9.1.x is EOL (End of Life), consider upgrading. https://www.eclipse.org/jetty/documentation/current/what-jetty-version.html
This question already has answers here:
How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version
(51 answers)
Closed 6 years ago.
When I run...
grails package
java -jar build/libs/<my_app>.jar
I get...
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/company/my_app/Application : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:170)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:142)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:47)
at java.lang.Thread.run(Thread.java:745)
This turn out to be simple enough. I was running with Java 7. When I upgraded to Java 8, everything worked fine.
I am using Grails 3.0.5
I get this error when trying to deploy using java -Dgrails.env=prod -jar
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Grails application running at http://localhost:8080 in environment: production
ERROR StackTrace - Full Stack Trace:
org.grails.taglib.GrailsTagException: [views/layouts/secure0.gsp:142] Error executing tag <g:render>: PermGen space
at org.grails.gsp.GroovyPage.throwRootCause(GroovyPage.java:445) ~[grails-gsp-3.0.5.jar!/:3.0.5]
at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:388) ~[grails-gsp-3.0.5.jar!/:3.0.5]
at sun.reflect.GeneratedMethodAccessor263.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_79]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) ~[groovy-2.4.4.jar!/:2.4.4]
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) ~[groovy-2.4.4.jar!/:2.4.4]
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384) ~[groovy-2.4.4.jar!/:2.4.4]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019) ~[groovy-2.4.4.jar!/:2.4.4]
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69) ~[groovy-2.4.4.jar!/:2.4.4]
Before deployment, I test in localhost, and it runs without any error.
But after deployment I get this error.
What's wrong with my code?
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Grails application running at http://localhost:80 in environment: production
ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[grailsDis patcherServlet] - Servlet.service() for servlet [grailsDispatcherServlet] in con text with path [] threw exception [Handler processing failed; nested exception i s java.lang.OutOfMemoryError: PermGen space] with root cause
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.7.0_79]
at java.lang.ClassLoader.defineClass(ClassLoader.java:800) ~[na:1.7.0_79 ]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14 2) ~[na:1.7.0_79]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) ~[na:1.7 .0_79]
at java.net.URLClassLoader.access$100(URLClassLoader.java:71) ~[na:1.7.0 _79]
at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.7.0_79]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_79]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0 _79]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0 _79]
at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(La unchedURLClassLoader.java:163) ~[ChatV3-0.1.jar!/:na]
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(Laun chedURLClassLoader.java:136) ~[ChatV3-0.1.jar!/:na]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[na:1.7.0_79]
at org.grails.buffer.StreamCharBuffer$MultipartCharBufferChunk.asStringC hunk(StreamCharBuffer.java:1864) ~[grails-encoder-3.0.5.jar!/:3.0.5]
at org.grails.buffer.StreamCharBuffer.readToSingleStringChunk(StreamChar Buffer.java:720) ~[grails-encoder-3.0.5.jar!/:3.0.5]
at org.grails.buffer.StreamCharBuffer.toString(StreamCharBuffer.java:700 ) ~[grails-encoder-3.0.5.jar!/:3.0.5]
at org.grails.buffer.FastStringWriter.getValue(FastStringWriter.java:63) ~[grails-encoder-3.0.5.jar!/:3.0.5]
at org.grails.buffer.FastStringWriter.toString(FastStringWriter.java:59) ~[grails-encoder-3.0.5.jar!/:3.0.5]
at org.grails.web.pages.GroovyPagesUriSupport.getAbsoluteViewURIInternal (GroovyPagesUriSupport.java:225) ~[grails-web-common-3.0.5.jar!/:3.0.5]
at org.grails.web.pages.GroovyPagesUriSupport.getAbsoluteViewURI(GroovyP agesUriSupport.java:161) ~[grails-web-common-3.0.5.jar!/:3.0.5]
at org.grails.web.gsp.io.GrailsConventionGroovyPageLocator.findViewByPat h(GrailsConventionGroovyPageLocator.java:68) ~[grails-web-gsp-3.0.5.jar!/:3.0.5]
at org.grails.web.servlet.view.GroovyPageViewResolver.createGrailsView(G roovyPageViewResolver.java:186) ~[grails-web-gsp-3.0.5.jar!/:3.0.5]
at org.grails.web.servlet.view.GroovyPageViewResolver$1.call(GroovyPageV iewResolver.java:113) ~[grails-web-gsp-3.0.5.jar!/:3.0.5]
at org.grails.web.servlet.view.GroovyPageViewResolver$1.call(GroovyPageV iewResolver.java:110) ~[grails-web-gsp-3.0.5.jar!/:3.0.5]
at grails.util.CacheEntry.updateValue(CacheEntry.java:170) ~[grails-core -3.0.5.jar!/:3.0.5]
at grails.util.CacheEntry.getValue(CacheEntry.java:144) ~[grails-core-3. 0.5.jar!/:3.0.5]
at grails.util.CacheEntry.getValue(CacheEntry.java:84) ~[grails-core-3.0 .5.jar!/:3.0.5]
at grails.util.CacheEntry.getValue(CacheEntry.java:102) ~[grails-core-3. 0.5.jar!/:3.0.5]
at org.grails.web.servlet.view.GroovyPageViewResolver.loadView(GroovyPag eViewResolver.java:124) ~[grails-web-gsp-3.0.5.jar!/:3.0.5]
at grails.plugin.scaffolding.ScaffoldingViewResolver.loadView(Scaffoldin gViewResolver.groovy:36) ~[scaffolding-3.1.1.jar!/:na]
at org.springframework.web.servlet.view.AbstractCachingViewResolver.crea teView(AbstractCachingViewResolver.java:244) ~[spring-webmvc-4.1.7.RELEASE.jar!/ :4.1.7.RELEASE]
at org.springframework.web.servlet.view.UrlBasedViewResolver.createView( UrlBasedViewResolver.java:446) ~[spring-webmvc-4.1.7.RELEASE.jar!/:4.1.7.RELEASE ]
at org.springframework.web.servlet.view.AbstractCachingViewResolver.reso lveViewName(AbstractCachingViewResolver.java:146) ~[spring-webmvc-4.1.7.RELEASE. jar!/:4.1.7.RELEASE]
ERROR StackTrace - Full Stack Trace:
org.grails.taglib.GrailsTagException: [views/layouts/main.gsp:8] Error executing tag <asset:stylesheet>: PermGen space
at org.grails.gsp.GroovyPage.throwRootCause(GroovyPage.java:445) ~[grail s-gsp-3.0.5.jar!/:3.0.5]
at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:388) ~[grails-gsp -3.0.5.jar!/:3.0.5]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7. 0_79]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:57) ~[na:1.7.0_79]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:43) ~[na:1.7.0_79]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java: 93) ~[groovy-2.4.4.jar!/:2.4.4]
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) ~[groovy-2
ERROR org.apache.catalina.core.ContainerBase - Unexpected death of background thread ContainerBackgroundProcessor[StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
java.lang.OutOfMemoryError: PermGen space
Exception in thread "ContainerBackgroundProcessor[StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "ContainerBackgroundProcessor[StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]"
This is what I try to do..
[root#server chat]# export GRAILS_OPTS="-server -d64 -XX:MaxPermSize=1024 -Xmx1024m"
[root#server chat]# java -Dgrails.env=prod -jar ChatV3-0.1.jar
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Grails application running at http://localhost:80 in environment: production
ERROR asset.pipeline.AssetSpecLoader - Error loading asset specification asset.pipeline.CssAssetFile: PermGen space
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.7.0_79]
at java.lang.ClassLoader.defineClass(ClassLoader.java:800) ~[na:1.7.0_79]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.7.0_79]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) ~[na:1.7.0_79]
at java.net.URLClassLoader.access$100(URLClassLoader.java:71) ~[na:1.7.0_79]
at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.7.0_79]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_79]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_79]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_79]
at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:163) ~[ChatV3-0.1.jar!/:na]
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:136) ~[ChatV3-0.1.jar!/:na]
When I tried to get Java
[root#server chat]# ps -ax | grep java
3700 ? Sl 1:27 /usr/java/jdk1.7.0_79/bin/java -Xms1G -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/root/apache-activemq/conf/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir=/root/apache-activemq/tmp -Dactivemq.classpath=/root/apache-activemq/conf; -Dactivemq.home=/root/apache-activemq -Dactivemq.base=/root/apache-activemq -Dactivemq.conf=/root/apache-activemq/conf -Dactivemq.data=/root/apache-activemq/data -jar /root/apache-activemq/bin/activemq.jar start
11544 pts/0 S+ 0:00 grep --color=auto java
You got a PermGen error.
Try using somethink like:
$ export GRAILS_OPTS="-XX:MaxPermSize=1024m -Xmx1024M -server"
$ java -Dgrails.env=prod -jar
Take a look on this questions/answers, they will help you:
Grails and PermGen issue with g:link and g:render
Grails PermGem error
I resolve my problem with
java -XX:MaxPermSize:1024m -Dgrails.env=prod -jar hellowWorld.jar
Trying to get our application up and running with 2.4.0.RC1 and I keep running into this error:
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [grails.plugin.cache.CustomCacheKeyGenerator]: Constructor threw exception; nested exception is java.lang.RuntimeException: java.lang.ClassNotFoundException: org.springframework.cache.interceptor.SimpleKeyGenerator
... 4 more
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.springframework.cache.interceptor.SimpleKeyGenerator
at grails.plugin.cache.CustomCacheKeyGenerator.<init>(CustomCacheKeyGenerator.java:46)
... 4 more
Caused by: java.lang.ClassNotFoundException: org.springframework.cache.interceptor.SimpleKeyGenerator
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:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName(Class.java:190)
at grails.plugin.cache.CustomCacheKeyGenerator.<init>(CustomCacheKeyGenerator.java:43)
... 4 more
I've upgraded to the latest version of cache (1.1.6). It seems like some kind of version conflict with the spring cache stuff, but I checked the dependency report and didn't see anything unusual being pulled in.
Anyone else run into this problem and have a solution?
It turns out that spring-integration-core version 3.0.3 was including an older version of spring-context that I missed.
Upgrading to spring-integration-core version 4.0.0 uses the same version of Spring 4 as Grails.
I've installed ubuntu 10.10 in my system and installed ant with the following command:
sudo apt-get install ant
Now, ant is visible in the share folder, so I've tried to run the ant command in terminal, but it gives me this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: org.apache.tools.ant.launch.Launcher. Program will exit.
Then I set these again:
JAVA_HOME="/usr/lib/jvm/java-6-sun-1.6.0.22/"
ANT_HOME="/usr/share/ant/"
PATH="/usr/share/ant/bin/"
Now it is giving me the same error but with one different line at starting:
/usr/share/ant/bin/ant: 92: uname: not found
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: org.apache.tools.ant.launch.Launcher. Program will exit.
try the following:
JAVA_HOME="/usr/lib/jvm/java-6-sun"
ANT_HOME="/usr/share/ant" # do not add "bin" at the end of the path**
PATH="$ANT_HOME/bin:$PATH"