Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails 2.4.0 on Mac OS X extension class fails to load

Tags:

macos

grails

After downloading and installing Grails 2.4.0, I get the following warning when running any grails command, including grails -version:

WARNING: Module [groovy-all] - Unable to load extension class [org.codehaus.groovy.runtime.NioGroovyMethods]

A web search revealed this post about groovy: http://permalink.gmane.org/gmane.comp.lang.groovy.user/64538

And this one, which includes, but is not specifically about this warning: https://jira.grails.org/browse/GPFILTERPANE-125

I am running Mac OS X 10.9.3, java version "1.7.0_40".

Is this a spurious error that can be ignored? So far, grails seems to be working fine, but I thought I would post about it to see if others have experienced something similar.

like image 395
augustearth Avatar asked May 28 '14 19:05

augustearth


2 Answers

The problem is grails sets JAVA_HOME to /Library/Java/Home if JAVA_HOME is not set. Most likely, your system have older jdk (1.6) under that directory. As paranoid mentioned, it requires jdk 1.7. Therefore, even if you have jdk1.7 installed, but grails doesn't use it at all.

Here is the solution to this problem:

  1. Download and install Oracle JDK, which will be installed to /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk (say if you install jdk1.7u51)
  2. Run the following commands to change the system settings if you don't want set JAVA_HOME explicitly
cd /System/Library/Frameworks/JavaVM.framework/Versions 
rm CurrentJDK 
ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents CurrentJDK

Then the warning should go away.

like image 138
Mingjiang Shi Avatar answered Oct 22 '22 16:10

Mingjiang Shi


  1. Install Java 7

  2. Found where is Java 7 Home.

On Mac OS run /usr/libexec/java_home. For example my home is /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home

  1. Create env variables GRAILS_HOME, JAVA_HOME and add them to PATH and to .bash_profile

For example contents of my .bash_profile file is:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home
export GRAILS_HOME=/Users/admin/work/grails
export PATH=$JAVA_HOME:$GRAILS_HOME/bin:$PATH

Now grails is using jdk7 and is without warnings.

like image 39
Rio Avatar answered Oct 22 '22 15:10

Rio