Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incompatible JVM in GGTS (Eclipse) and JAVA 1.8

Tags:

java

eclipse

ggts

Having some problem with running a grails application in GGTS (eclipse) due to upgrade to Java 1.8.

The stack starts with:

Mar 05, 2015 3:51:31 PM org.springsource.loaded.jvm.JVM copyMethod SEVERE: Problems copying method. Incompatible JVM? java.lang.reflect.InvocationTargetException     at sun.reflect.GeneratedMethodAccessor91.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:497)     at org.springsource.loaded.jvm.JVM.copyMethod(JVM.java:134)     at org.springsource.loaded.ri.OriginalClassInvoker.createJavaMethod(OriginalClassInvoker.java:68)     at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredMethods(ReflectiveInterceptor.java:151)     at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:84)     at java.security.AccessController.doPrivileged(Native Method)     at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81) ...     at java.lang.reflect.Method.invoke(Method.java:497)     at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)     at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:236)     at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:264) Caused by: java.lang.IllegalArgumentException: Can not copy a non-root Method     at java.lang.reflect.Method.copy(Method.java:151)     ... 280 more 

I used to run the same application in Java 1.7. My colleagues upgraded to 1.8 and no longer able to run it.

I tested with SUN JDK and now I am on OpenJDK again and that does not help Current JDK openjdk version "1.8.0_40"

JAVA_HOME, JAVA_PATH and any other variable seems to point to the correct JDK installation. I have removed all the previous (JDK 1.6 & 1.7 from the OS to be sure that there is no reference to them).

For some reason GGTS still complains for a wrong JVM. I understand the error might be related to a compiler 1.7 trying to compile files in the 1.8, but I am not sure where this reference is comming from in eclipse.

My Eclipse installation information lists the following under Java:

-vm /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java eclipse.home.location=file:/home/arb/dev/applications/ggts-3.6.3.SR1/ eclipse.launcher=/home/arb/dev/applications/ggts-3.6.3.SR1/GGTS eclipse.launcher.name=GGTS [email protected]/../p2 eclipse.p2.profile=DefaultProfile eclipse.product=org.springsource.ggts.ide eclipse.startTime=1425566898624 eclipse.stateSaveDelayInterval=30000 eclipse.vm=/usr/lib64/jvm/jre-1.8.0-openjdk/bin/java eclipse.vmargs=-Dgrails.console.enable.interactive=false -Dgrails.console.enable.terminal=false -Djline.terminal=jline.UnsupportedTerminal -Dgrails.console.class=grails.build.logging.GrailsEclipseConsole -Dosgi.requiredJavaVersion=1.6 -Xms60m -Xmx1024m 
like image 728
Al-Punk Avatar asked Mar 05 '15 14:03

Al-Punk


People also ask

How do I fix incompatible JVM?

Solution 1: Just Add the -vm parameters in the eclipse configuration file. To resolve this error only you have to add the following two lines directly before the line -vmargs and adapt the path to your Java 11 or higher 64-bit Java VM installation directory. Just add this line in your eclipse.

Which Eclipse version is compatible with Java 8?

A Java 8 or newer JRE/JDK is required to run all Eclipse 2019-09 packages based on Eclipse 4.14, as well as the Installer.


1 Answers

Version 1.8.0_40 and 1.8.0_45 has breaking updates with grails. Spring can not copy non-Root methods.

Since the initial posting a workaround has been developed.

aclement commented on Mar 5 Here is the build: http://repo.spring.io/libs-snapshot-local/org/springframework/springloaded/1.2.2.BUILD-SNAPSHOT/springloaded-1.2.2.BUILD-SNAPSHOT.jar

To test it under grails, what I do is go into the grails folder: grails-2.5.0/lib/org.springframework/springloaded/jars

I then rename the spring loaded jar that is there and put in a symlink to the jar above. It used to be that you could just modify the startGrails script to point to the new version, but now due to the forking I find you need to do the symlink thing. Or drop that jar into this folder and rename it to match the expectations of grails (rename it from springloaded-1.2.2.BUILD-SNAPSHOT.jar to springloaded-1.2.0.RELEASE.jar)

If you want to rollback instead

Grails is natively supported in 1.8.0_25, 1.8.0_31

http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html#jdk-8u25-oth-JPR

Once you have a compatible java version clean your grails project. Ensure that your java path variables are set to point to your expected version.

set JAVA_HOME=C:\java\jdk1.8.0_25 set PATH=%JAVA_HOME%\bin;%PATH%; 
like image 165
penguin Avatar answered Sep 23 '22 06:09

penguin