12.7. JRockit
JRockit also supports the
-javaagent
switch mentioned in Section 12.6, “Loadtime transformation in the JBoss Enterprise Application Platform Using Sun JDK”. If you wish to use that, then the steps in Section 12.6, “Loadtime transformation in the JBoss Enterprise Application Platform Using Sun JDK” are sufficient. However, JRockit also comes with its own framework for intercepting when classes are loaded, which might be faster than the -javaagent
switch. If you want to do load-time transformations using the special JRockit hooks, these are the steps you must take.
- Set the
enableLoadtimeWeaving
attribute/property to true. By default, JBoss Enterprise Application Platform will not do load-time bytecode manipulation of AOP files unless this is set. IfsuppressTransformationErrors
istrue
, failed bytecode transformation will only give an error warning. This flag is needed because sometimes a JBoss deployment will not include all the classes referenced. - Copy the
jrockit-pluggable-instrumentor.jar
from thelib/
directory of your JBoss AOP distribution to thebin/
directory of your the JBoss Enterprise Application Platform installation. - Next edit
run.sh
orrun.bat
(depending on what OS you are on) and add the following to theJAVA_OPTS
andJBOSS_CLASSPATH
environment variables:# Setup JBoss specific properties JAVA_OPTS="$JAVA_OPTS -Dprogram.name=$PROGNAME \ -Xmanagement:class=org.jboss.aop.hook.JRockitPluggableClassPreProcessor" JBOSS_CLASSPATH="$JBOSS_CLASSPATH:jrockit-pluggable-instrumentor.jar"
- Set the class of the
AspectManager
Service toorg.jboss.aop.deployers.AspectManagerJRockit
on JBoss Enterprise Application Platform 5, ororg.jboss.aop.deployment.AspectManagerService
as these are what work with special hooks in JRockit.