Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-569

java.lang.ClassFormatError running groovy script from shell (bash)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.1-rc-1
    • 1.5.2, 1.6-rc-2
    • None
    • None
    • % uname -a
      Linux darwin.triactive.com 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux

    Description

      Tried to run a very simple (print "helloWorld") script. Runs fine using groovy compiler, groovysh, but throws exception when trying to run as standalone script.
      Script, exception, compiler output, script output, env and groovysh output below:

      % cat helloWorld
      #!/usr/bin/env groovy
      print "helloWorld"

      % ./helloWorld
      Exception in thread "main" java.lang.ClassFormatError: (Illegal Class name "")
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
      at groovy.lang.GroovyClassLoader.access$100(GroovyClassLoader.java:78)
      at groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:470)
      at groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:480)
      at org.codehaus.groovy.control.CompilationUnit$5.call(CompilationUnit.java:674)
      at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:932)
      at org.codehaus.groovy.control.CompilationUnit.classgen(CompilationUnit.java:591)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:485)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:226)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:154)
      at groovy.lang.GroovyShell$2.run(GroovyShell.java:212)
      at java.security.AccessController.doPrivileged(Native Method)
      at groovy.lang.GroovyShell.run(GroovyShell.java:210)
      at groovy.lang.GroovyShell.main(GroovyShell.java:94)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:410)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:461)

      % groovy helloWorld
      helloWorld

      % env
      KDE_MULTIHEAD=false
      SSH_AGENT_PID=19891
      HOSTNAME=darwin.triactive.com
      JRUN_HOME=/dev/null
      TERM=xterm
      SHELL=/bin/bash
      HISTSIZE=1000
      GTK_RC_FILES=/etc/gtk/gtkrc:/home/fran/.gtkrc:/home/fran/.gtkrc-kde
      CVSROOT=:pserver:fran@cvs:/usr/local/cvs
      GS_LIB=/home/fran/.kde/share/fonts
      OLDPWD=/home/fran/dev/groovy
      QTDIR=/usr/lib/qt-3.1
      JBOSS_HOME=/usr/local/jboss
      USER=fran
      LD_LIBRARY_PATH=/usr/local/lib
      LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:.cmd=00;32:.exe=00;32:.com=00;32:.btm=00;32:.bat=00;32:.sh=00;32:.csh=00;32:.tar=00;31:.tgz=00;31:.arj=00;31:.taz=00;31:.lzh=00;31:.zip=00;31:.z=00;31:.Z=00;31:.gz=00;31:.bz2=00;31:.bz=00;31:.tz=00;31:.rpm=00;31:.cpio=00;31:.jpg=00;35:.gif=00;35:.bmp=00;35:.xbm=00;35:.xpm=00;35:.png=00;35:.tif=00;35:
      SSH_AUTH_SOCK=/tmp/ssh-XXwRPpdo/agent.19848
      SESSION_MANAGER=local/darwin.triactive.com:/tmp/.ICE-unix/19960
      KONSOLE_DCOP=DCOPRef(konsole-19982,konsole)
      MAVEN_HOME=/usr/local/src/maven-1.0-rc4
      PATH=/home/fran/bin:/home/fran/dev/ant/bin:/usr/local/epsilon11/bin:/usr/local/groovy/bin:/home/fran/bin:/home/fran/dev/ant/bin:/usr/local/epsilon11/bin:/usr/local/groovy/bin:/usr/java/bin:/usr/local/resin/bin:/usr/local/jboss/bin:/usr/local/apache/bin:/usr/local/epsilon11/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/fran/bin:/usr/local/src/maven-1.0-rc4/bin:.
      MAIL=/var/spool/mail/fran
      KONSOLE_DCOP_SESSION=DCOPRef(konsole-19982,session-4)
      PWD=/home/fran
      INPUTRC=/etc/inputrc
      XMODIFIERS=@im=none
      JAVA_HOME=/usr/java
      LANG=en_US.UTF-8
      GDMSESSION=KDE
      SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
      SHLVL=3
      HOME=/home/fran
      LOGNAME=fran
      GROOVY_HOME=/usr/local/groovy
      RESIN_HOME=/usr/local/resin
      PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
      LESSOPEN=|/usr/bin/lesspipe.sh %s
      DISPLAY=:0
      APACHE_HOME=/usr/local/apache
      DEV=/home/fran/dev/
      G_BROKEN_FILENAMES=1
      COLORTERM=
      XAUTHORITY=/home/fran/.Xauthority
      _=/usr/bin/env

      % groovysh
      Lets get Groovy!
      ================
      Version: 1.0-beta-6-SNAPSHOT JVM: 1.4.2_04-b05
      Type 'exit' to terminate the shell
      Type 'help' for command help

      1> print "helloWorld"
      2> go
      helloWorld
      1> quit
      %

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              frank YunFeng Ma
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: