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

BMUnit will not autoload Byteman agent on Windows 7

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.1.3
    • Fix Version/s: 2.1.4
    • Component/s: Contrib
    • Labels:
      None
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      The agent can be loaded on the Java command line. This requires several steps to achieve the setup that BMUnit automatically provides:

      1) add the -javaagent argument to the command line

      -javaagent:$PATH/byteman.jar=listener:true,boot:$PATH/byteman.jar

      where PATH is a path to the byteman agent jar (byteman.jar). NOtice that this argument provides a path to the agent jar, enables the agent listener (so BMUnit can load your rules) and also adds the byteman jar to the bootstrap path, ensuring that you can load rules into System classes like FileOutputStream etc.

      If you are have downloaded a byteman zip release then his will be the lib directory of your byteman download e.g.

      ${BYTEMAN_HOME}/lib

      If you are using maven then this will be a path to the appropriate version of the byteman jar in your local maven repository e.g.

      ${settings.localRepository}/org/jboss/byteman/byteman/${byteman.version}/byteman-${byteman.version}.jar

      2) set the following system property (to any value) to stop BMUnit trying to load the agent

      org.jboss.byteman.contrib.bmunit.agent.inhibit

      If you are using ant then you can set this using a command line argument. If you are using maven then you can set it as a system property in your test configuration specification.

      3) set the following system property (to any value) so that injection into java.lang classes is enabled

      org.jboss.byteman.transform.all

      Show
      The agent can be loaded on the Java command line. This requires several steps to achieve the setup that BMUnit automatically provides: 1) add the -javaagent argument to the command line -javaagent:$PATH/byteman.jar=listener:true,boot:$PATH/byteman.jar where PATH is a path to the byteman agent jar (byteman.jar). NOtice that this argument provides a path to the agent jar, enables the agent listener (so BMUnit can load your rules) and also adds the byteman jar to the bootstrap path, ensuring that you can load rules into System classes like FileOutputStream etc. If you are have downloaded a byteman zip release then his will be the lib directory of your byteman download e.g. ${BYTEMAN_HOME}/lib If you are using maven then this will be a path to the appropriate version of the byteman jar in your local maven repository e.g. ${settings.localRepository}/org/jboss/byteman/byteman/${byteman.version}/byteman-${byteman.version}.jar 2) set the following system property (to any value) to stop BMUnit trying to load the agent org.jboss.byteman.contrib.bmunit.agent.inhibit If you are using ant then you can set this using a command line argument. If you are using maven then you can set it as a system property in your test configuration specification. 3) set the following system property (to any value) so that injection into java.lang classes is enabled org.jboss.byteman.transform.all

      Description

      BMUnit relies upon the API provided by the JVM Tools library class VirtualMachine to automatically locate the current Java process and load the Byteman agent before it runs BMUnit tests. On Windows method VirtualMachine.list() is used to locate all running JVMs and their associated processids (pids). A secondary API of VirtualMachine is used to identify which pid belongs current JVM.

      VirtualMachine.list() appears not to be functioning correctly on Windows 7 as it returns no candidate JVMs. There does not appear to be any portable way to identify the current pid so this means BMUNit will be broken until the WIndows 7 implementation of VirtualMachine is fixed.

      A workaround is available (See workarounds section of this JIRA).

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                adinn Andrew Dinn
                Reporter:
                adinn Andrew Dinn
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: