Grails: Error starting Sun’s native2ascii


More issues with Grails. The environment seemed to be working, but once I start compiling and generating all the files. I ran into more issues. When running the grails war to generate a war to deploy to Mor.ph I go the following error. This error also occurs for the generate-all command.

Error executing script War: : Error starting Sun's native2ascii:
gant.TargetExecutionException: : Error starting Sun's native2ascii:

To fixing it I found this mailing list response. The problem was that my JAVA_HOME environment variable pointed to the JRE and not to the JDK. Changing it to point to the JDK fixed the problem. Below is the entire printout of the error.

Running script C:\dev\grails-1.1\scripts\War.groovy
Environment set to production
Warning, target causing name overwriting of name startLogging
  [groovyc] Compiling 1 source file to C:\Users\Morten\.grails\1.1\projects\GrailsHello3\classes
[native2ascii] Converting 11 files from C:\Users\Morten\IdeaProjects\GrailsHello3\grails-app\i18n to C:\Users\Morten\.grails\1.1\projects\GrailsHello3\resources\grails-app\i18n
Error executing script War: : Error starting Sun's native2ascii:
gant.TargetExecutionException: : Error starting Sun's native2ascii:
    at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:331)
    at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
    at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
    at gant.Gant.withBuildListeners(Gant.groovy:344)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:334)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.processTargets(Gant.groovy:495)
    at gant.Gant.processTargets(Gant.groovy:480)
Caused by: : Error starting Sun's native2ascii:
    at org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii.run(SunNative2Ascii.java:67)
    at org.apache.tools.ant.taskdefs.optional.native2ascii.DefaultNative2Ascii.convert(DefaultNative2Ascii.java:54)
    at org.apache.tools.ant.taskdefs.optional.Native2Ascii.convert(Native2Ascii.java:268)
    at org.apache.tools.ant.taskdefs.optional.Native2Ascii.execute(Native2Ascii.java:227)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at _GrailsPackage_groovy$_run_closure2_closure13.doCall(_GrailsPackage_groovy:108)
    at _GrailsPackage_groovy$_run_closure2_closure13.doCall(_GrailsPackage_groovy)
    at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:269)
    at _GrailsPackage_groovy$_run_closure2.doCall(_GrailsPackage_groovy:107)
    at _GrailsWar_groovy$_run_closure4.doCall(_GrailsWar_groovy:125)
    at War$_run_closure1.doCall(War:38)
    at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
    ... 10 more
Caused by: java.lang.ClassNotFoundException: sun.tools.native2ascii.Main
    at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:156)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:128)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii.run(SunNative2Ascii.java:51)
    ... 22 more
Bookmark and Share

, ,

  1. #1 by Paras Jain on October 12, 2009 - 16:50

    Thanks. This helped

  2. #2 by alun on October 18, 2009 - 14:49

    It was helpful. Thanks a lot

  3. #3 by tonio on June 8, 2010 - 07:56

    thanks :)

  4. #4 by Manny on July 2, 2010 - 10:37

    Thank you, this helped me in discovering the problem with my Eclipse even though JAVA_HOME was not the culprit in my case.

  5. #5 by Dilli on June 6, 2011 - 14:13

    Manny :
    Thank you, this helped me in discovering the problem with my Eclipse even though JAVA_HOME was not the culprit in my case.

    Hi,
    I am also facing same problem. I set the JAVA_HOME properly, still I am getting the error. Can you please tell me what could be the error?

    Thanks,
    –Dilli

  6. #6 by Long Van on February 6, 2012 - 04:50

    thank … you help me a lot … when i install java … I use “yum install java” … so when i set JAVA_HOME … i get some problem . following is errors ….. I solved this .thanks and thanks

(will not be published)