2 Replies Latest reply on Mar 22, 2012 2:37 PM by vojedav

    Using Byteman to test a class within a jar within an ear

      Hi all,

       

        I have an .ear file with a .jar file inside.

        I want to test some functions that belongs to a class contained in the jar file.

        The question is: how configure this?

      In run.sh of JBoss 5.1 I put the following:

       

      set JAVA_OPTS="${JAVA_OPTS} -Dorg.jboss.byteman.transform.all -javaagent:${BYTEMAN_HOME}/lib/byteman.jar=script:${BYTEMAN_HOME}/bin/thread.btm,boot:${BYTEMAN_HOME}/lib/byteman.jar,listener:true"

       

      Of course, BYTEMAN_HOME is set to the correct value.

       

      My very simple thread.btm file looks like:

       

      RULE test inside an ear

       

      CLASS com.acme.Test

       

      METHOD test

       

      IF true

       

      DO traceln("*** TESTING BYTEMAN ")

       

      ENDRULE

       

      --------------------------------------

      The ear structure is

       

      META-INF

        application.xml

        MANIFEST.MF

       

      myJar.jar

       

      ---------------------------------------

       

      The myJar.jar estructure is

       

      META-INF

        MANIFEST.MF

        com

          acme

            Test.class

       

       

      The Test class have a method called public void test()

       

      How to make this work?

       

      Thanks in advance

       

      Best regards,

       

        Víctor

        • 1. Re: Using Byteman to test a class within a jar within an ear
          adinn

          Victor M. Ojeda V. wrote:

           

          . . .

          In run.sh of JBoss 5.1 I put the following:

           

          set JAVA_OPTS="${JAVA_OPTS} -Dorg.jboss.byteman.transform.all -javaagent:${BYTEMAN_HOME}/lib/byteman.jar=script:${BYTEMAN_HOME}/bin/thread.btm,boot:${BYTEMAN_HOME}/lib/byteman.jar,listener:true"

           

          . . .

           

          How to make this work?

           

          run.sh is a bourne shell script (/bin/sh) so set is not te command you are looking for. try adding this instead

           

           

           

          export JAVA_OPTS="${JAVA_OPTS} -Dorg.jboss.byteman.transform.all -javaagent:${BYTEMAN_HOME}/lib/byteman.jar=script:${BYTEMAN_HOME}/bin/thread.btm,boot:${BYTEMAN_HOME}/lib/byteman.jar,listener:true"

          • 2. Re: Using Byteman to test a class within a jar within an ear

            Yes. My fault. Thanks Andrew. It works !!!