Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-5856

twiddle.sh fails when run through CYGWIN on Windows with a space in the classpath

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • EAP_EWP 5.3.0.ER1
    • EAP_EWP 5.1.0
    • Scripts and Commands
    • None
    • JBoss EAP 5.1.0 running on Windows through CYGWIN

    • Hide

      Install JBoss in Windows under 'C:\Program Files' or another directory with a space. Then try to run twiddle.sh through CYGWIN.

      Show
      Install JBoss in Windows under 'C:\Program Files' or another directory with a space. Then try to run twiddle.sh through CYGWIN.
    • Hide
      In previous versions of EAP 5, it was found that the <filename>twiddle.bat</filename> script would fail when run in CYGWIN if the JBOSS_CLASSPATH variable resolved to a path that included spaces (<filename>C:\Program Files\...</filename>, for example).

      The <filename>twiddle.bat</filename> script has been modified to include quotes around the variable which preserves the path when it includes spaces and allows the script to execute as expected.
      Show
      In previous versions of EAP 5, it was found that the <filename>twiddle.bat</filename> script would fail when run in CYGWIN if the JBOSS_CLASSPATH variable resolved to a path that included spaces (<filename>C:\Program Files\...</filename>, for example). The <filename>twiddle.bat</filename> script has been modified to include quotes around the variable which preserves the path when it includes spaces and allows the script to execute as expected.
    • Documented as Resolved Issue
    • ASSIGNED

      When twiddle.sh is run through CYGWIN in Windows from an installation with a space in its path (e.g. C:\Program Files\...), it fails with a NoClassDefFoundError:

      java.lang.NoClassDefFoundError: Files\EnterprisePlatform-5/1/0\jboss-eap-5/1\jboss-as\bin\twiddle/jar;c:\Program
      Caused by: java.lang.ClassNotFoundException: Files\EnterprisePlatform-5.1.0\jboss-eap-5.1\jboss-as\bin\twiddle.jar;c:\Program
      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
      Could not find the main class: Files\EnterprisePlatform-5.1.0\jboss-eap-5.1\jboss-as\bin\twiddle.jar;c:\Program. Program will exit.
      Exception in thread "main"

      The root cause of this is this last portion of the script that initializes the twiddle java process:

      exec "$JAVA" \
      $JAVA_OPTS \
      -Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \
      -Dprogram.name="$PROGNAME" \
      -classpath $JBOSS_CLASSPATH \
      org.jboss.console.twiddle.Twiddle "$@"

      In this current state, if the JBOSS_CLASSPATH has a space in it, it will be split and treated as two different arguments, explaining the error. By quoting $JBOSS_CLASSPATH, this will now be treated as one argument again even with spaces. Attached is twiddle.sh with this fix.

              istudens@redhat.com Ivo Studensky
              rhn-support-aogburn Aaron Ogburn
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: