Uploaded image for project: 'Byteman'
  1. Byteman
  2. BYTEMAN-352

Shell tooling script does not work when (JAVA|BYTEMAN)_HOME evn vars are defined with spaces

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0.12, 4.0.1
    • 3.0.11, 4.0.0
    • Tools
    • None
    • Hide
      git clone https://github.com/ochaloup/byteman-workshop.git
      cd byteman-workshop
      source setup.sh
      cd task1
      ../bin/byteman-dowload-4.0.0/bin/bmcheck.sh -p org.jboss.btm.workshop -cp target/byteman-workshop-task1-1.0.0-SNAPSHOT.jar task1.btm
      # working fine
      ln -s $BYTEMAN_HOME "../libs/b y t e m a n"
      export BYTEMAN_HOME="../libs/b y t e m a n"
      ../bin/byteman-dowload-4.0.0/bin/bmcheck.sh -p org.jboss.btm.workshop -cp target/byteman-workshop-task1-1.0.0-SNAPSHOT.jar task1.btm
      # fails
      
      Show
      git clone https: //github.com/ochaloup/byteman-workshop.git cd byteman-workshop source setup.sh cd task1 ../bin/byteman-dowload-4.0.0/bin/bmcheck.sh -p org.jboss.btm.workshop -cp target/byteman-workshop-task1-1.0.0-SNAPSHOT.jar task1.btm # working fine ln -s $BYTEMAN_HOME "../libs/b y t e m a n" export BYTEMAN_HOME= "../libs/b y t e m a n" ../bin/byteman-dowload-4.0.0/bin/bmcheck.sh -p org.jboss.btm.workshop -cp target/byteman-workshop-task1-1.0.0-SNAPSHOT.jar task1.btm # fails

      During preparation on workshop about Byteman I found that tools sh scripts do not work when paths contains spaces.

      You can get errors from the shell script like Unable to find byteman home or Cannot locate byteman jar.

      Similar for JAVA_HOME set with spaces you can get something similar to this

      [ochaloup@ochaloup task1 (basics_tasks)]$ $BYTEMAN_HOME/bin/bmsubmit.sh 10495
      Failed to process request: java.lang.Exception: Invalid rule file: 10495
      -- Args were: [10495]
      java.lang.Exception: Invalid rule file: 10495
      at org.jboss.byteman.agent.submit.Submit.getRulesFromRuleFiles(Submit.java:829)
      at org.jboss.byteman.agent.submit.Submit.addRulesFromFiles(Submit.java:554)
      at org.jboss.byteman.agent.submit.Submit.main(Submit.java:1147)
      [ochaloup@ochaloup task1 (basics_tasks)]$ /home/ochaloup/presentations/byteman-workshop/libs/byteman-download-4.0.0/bin/bminstall.sh 10495
      /home/ochaloup/presentations/byteman-workshop/libs/byteman-download-4.0.0/bin/bminstall.sh: line 86: [: too many arguments
      Cannot locate tools jar
      Error: A JNI error has occurred, please check your installation and try again
      Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/attach/AttachNotSupportedException
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
      at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
      at java.lang.Class.getMethod0(Class.java:3018)
      at java.lang.Class.getMethod(Class.java:1784)
      at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
      at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
      Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AttachNotSupportedException
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 7 more
      [ochaloup@ochaloup task1 (basics_tasks)]$ echo $JAVA_HOME
      /home/ochaloup/presentations/byteman-workshop/libs/j d k
      

              ochaloup@redhat.com Ondrej Chaloupka (Inactive)
              ochaloup@redhat.com Ondrej Chaloupka (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: