not able to find issue from bmcheck script output...
mahesh.shet Dec 21, 2015 10:44 AMHi,
I am trying to inject fault in a long running java application.
The rule file (test.btm) contains the following:
#==============================================================
# Throwing Exceptions on Calling MyTestAPI
#==============================================================
RULE Throw TestException
CLASS NewAccountCreate
METHOD TestMethod
AT ENTRY
IF TRUE
DO THROW new com.test.mvs..exception.TestException("This is a test exception");
ENDRULE
I am calling the bmcheck on test.btm and getting the following output:
./bmcheck.sh ../sample/mvsScripts/test.btm
ERROR : Could not load class NewAccountCreate declared in rule "Throw TestException" loaded from ../sample/mvsScripts/test.btm line 8
TestScript: 1 total errors
0 total warnings
0 parse errors
0 type errors
0 type warnings
Question1: Why bmcheck.sh output says could not load class? As I understand, bmcheck.sh checks for the validity of the rules....and I am not understanding where in the rule there is a problem.
Question2: I have successfully installed the byteman in to a long running java application.I am able to load the rules also. When I check if the rule is compiled successfully, i see compilation error as shown below (modified the part of the error to hide my code):
$ sudo ./bmsubmit.sh
# File ../sample/mvsScripts/test.btm line 9
RULE Throw TestException
CLASS NewAccountCreate
METHOD TestMethod
AT ENTRY
IF TRUE
DO THROW new com.test.mvs..exception.TestException("This is a test exception");
ENDRULE
Transformed in:
loader: sun.misc.Launcher$AppClassLoader@c387f44
trigger method: com.sometest.mvs.resources.NewAccountCreate.TestMethod(java.lang.String,com.sometest.mvs.requests.TestRequest,javax.ws.rs.core.HttpHeaders) javax.ws.rs.core.Response
failed to compile
Rule.ensureTypeCheckedCompiled : error type checking rule Throw TestException
org.jboss.byteman.rule.exception.TypeException: StringLiteral.typeCheck : invalid expected type com.sometest.mvs.data.enums.SomeResponseCode file ../sample/mvsScripts/test.btm line 11
Kindly help. Thanking you in advance.
Regards
Mahesh