0

I'm encountering a problem with the forked Grails process when executing from GGTS via run-app after upgrading to Java 1.8. It insists on running the forked instance of the application in the older Java 1.7 JVM after the having compiled everything with 1.8. This leads to an incompatible JVM error at runtime:

Caused by UnsupportedClassVersionError: Grails/plugin/springsecurity/userdetails/GrailsUserDetailsService : Unsupported major.minor version 52.0

I have spent some time looking around to see if others have encountered this and the answer is yes. But ... no real solutions other than re-installing GGTS.

Here is the information about my environment:

JAVA_HOME = /usr/lib/jvm/jdk1.8.0_65
GGTS.ini = /usr/lib/jvm/jdk1.8.0_65
Installed JRE's = /usr/lib/jvm/jdk1.8.0_65

I have NO Installed 1.7 JRE in my Workspace. I've checked a dozen times.

The GGTS instance is running inside a 1.8 jvm. The long running Grails process is running inside a 1.8 jvm. If I run grails from bash both it and the forked grails instance are running inside a 1.8 jvm. If I do a run app from GGTS however the forked grails runs in an old 1.7 jvm. I cannot find any reference in any configuration for a 1.7 jvm including .grails, GGTS.ini or any of the .eclipse settings files in the Workspace. Clearly there is some file somewhere that has a "cached" reference to the 1.7 JVM that I can't find. If I turn off forking in the BuildConfig.groovy, then it launches Grails in the primary process in a 1.8 JVM and everything works.

Finally, if I create a new Workspace then I can get it to run Grails in Java 1.8. As soon as I switch back to an older project with an older version of Grails and a Java 1.7 configuration, then magically the 1.7 JVM becomes preferred for the forked instance of Grails for all workspaces.

The fork directives in the BuildConfig.groovy specify arguments for the JVM but not the actual JVM itself. Where does that come from?

Steve Hole
  • 348
  • 2
  • 12
  • You shouldn't need to keep on re-installing ggts. http://stackoverflow.com/questions/28880781/incompatible-jvm-in-ggts-eclipse-and-java-1-8/34402846#34402846 Take a look at my comment. Try disabling forking and look at the spring-loaded version. There is a GGTS.ini inside the folder that you launch ggts from. check this https://wiki.eclipse.org/Eclipse.ini. Also check your environment variables. When you configure your application to use Java-8. This is all custom from there on and stored in .metadata folder in your workspace. If you create a new workspace ggts will reset to default jdk. – V H Dec 21 '15 at 19:22
  • I had looked through the referenced SO post, but my problem is not with the spring-loaded version -- at least I don't have the same symptoms. I have checked (repeatedly) the GGTS.ini and my bash environment. My JAVA_HOME, the GGTS.ini file and all of the Eclipse preferences specify the 1.8 JVM. As noted in the question, when I disable forking, it runs the 1.8 JVM. I don't want to disable forking however. When I run it (with forking enabled) from a bash shell, it launches correctly. It only uses the 1.7 JVM when I run-app from GGTS. Where does Grails get the JVM from inside of GGTS? – Steve Hole Dec 21 '15 at 20:27
  • https://issuetracker.springsource.com/plugins/servlet/mobile#issue/STS-3880 .. so looks like it's using system java. Take a look here https://github.com/vahidhedayati/documentation/blob/master/grails/.bashrc#L4. Set up your own override over what system sees as java. Possibly alias java over existing system known command – V H Dec 21 '15 at 21:02
  • OK, you are definitely on the right track. I actually already had an override in place in .bashrc which was being ignored. Changing the etc/alternatives didn't help either. However, when I run GGTS from the command line so that it picks up my complete .bashrc set up including JAVA_HOME and friends, it works. It is using the 1.7 JVM when I launch from the GNOME shell launcher and picking up some variant environment -- which is surprising to say the least. We have enough for a solution now I think. – Steve Hole Dec 21 '15 at 23:32

0 Answers0