Unexpected exception transforming using bmcheck
whitingjr Oct 11, 2012 12:04 PMHi,
I am using Byteman to expose counters for particular events in the system my team is using.
I have found the execution of the JMXHelper to work successfully to expose the counter on transformed bytecode.
But when I use the bmcheck.sh script Byteman is reporting an error. So I have a situation where a working script in the JVM is throwing this error message. Which is unexpected.
$ ~/java/jboss/byteman/byteman-download-2.1.0/bin/bmcheck.sh -cp ~/java/projects/sample-byteman-bmcheck-issue/src/main/java -cp ~/java/jboss/byteman/byteman-download-2.1.0/sample/lib/byteman-sample.jar ~/java/projects/sample-byteman-bmcheck-issue/src/main/resources/CountTheHello.btm
checking rule Connection timed key info against class org.jboss.byteman.sample.helper.JMXHelper
ERROR : Unexpected exception transforming class org.jboss.byteman.sample.helper.JMXHelper using rule "Connection timed key info" loaded from /home/whitingjr/java/projects/sample-byteman-bmcheck-issue/src/main/resources/CountTheHello.btm line 10
java.lang.NullPointerException
checking rule count the number of hello against class org.jboss.perf.HelloJBossWorld
parsed rule "count the number of hello" for class org.jboss.perf.HelloJBossWorld
type checked rule "count the number of cheers"
TestScript: 1 total errors
0 total warnings
0 parse errors
0 type errors
0 type warnings
$
This is my btm script.
########################################################################
#
# Rule to count the cheers
#
HELPER org.jboss.byteman.sample.helper.JMXHelper
RULE Connection timed key info
CLASS org.jboss.byteman.sample.helper.JMXHelper
METHOD keyInfo()
BIND keyInfo : KeyInfo = new KeyInfo("Statistics in a Dynamic MBean")
IF TRUE
DO
keyInfo.addKey("cheers counter", KeyInfo.KEY_TYPE_CUMULATIVE, "cheers counter");
RETURN keyInfo
ENDRULE
RULE count the number of hello
CLASS org.jboss.perf.HelloJBossWorld
METHOD main
AT ENTRY
IF TRUE
DO
incrementCounter("cheers counter")
ENDRULE
and this is my class
package org.jboss.perf;
public class HelloJBossWorld
{
public static void main(String args[])
{
System.out.println("Three cheers for Byteman.");
}
}
The class is a noddy class on which to run the bmcheck.sh script.
Is this supposed to happen with the bmcheck.sh script ?
Regards,
Jeremy