Using Byteman to troubleshoot Java issues in JBoss Fuse or A-MQ

Solution Verified - Updated

Environment

  • JBoss A-MQ
    • 6.x
  • JBoss Fuse 6.x
  • Byteman 3

Issue

  • How to configure JBoss A-MQ to use Byteman?
  • How to configure JBoss Fuse to use Byteman?

Resolution

The following apply for both A-MQ and Fuse where $PRODUCT_HOME is where you installed A-MQ or Fuse and $BYTEMAN_HOME is where you installed Byteman.

  1. Add org.jboss.byteman.* to org.osgi.framework.bootdelegation parameter in $PRODUCT_HOME/etc/config.properties. For example:
org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,sun.*,com.sun.*,javax.transaction,javax.transaction.*,org.apache.xalan.processor,org.apache.xpath.jaxp,org.apache.xml.dtm.ref,org.apache.xerces.jaxp.datatype,org.apache.xerces.stax,org.apache.xerces.parsers,org.apache.xerces.jaxp,org.apache.xerces.jaxp.validation,org.apache.xerces.dom,org.jboss.byteman.*
  1. Add Java VM option by executing the following command in your shell then start A-MQ or JBoss Fuse:
export JAVA_OPTS="-javaagent:$BYTEMAN_HOME/lib/byteman.jar=script:/path/to/your/script.btm,boot:$BYTEMAN_HOME/lib/byteman.jar"

If you want to persist the above Java VM option, you wan add it to $PRODUCT_HOME/bin/setenv (or $PRODUCT_HOME/bin/setenv.bat).

NOTE Do not use spaces in the path to the Byteman script file as this cannot be handled by the startup scripts.

Also see Using Byteman to troubleshoot Java issues for the usage and example script of Byteman.

Product(s)
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.