Byteman Helper class unexpected behavior in parameter
whobu23 Nov 7, 2014 11:54 AMI was originally trying to cast one of my objects to another object when I noticed some interesting behavior when calling the method in my helper class and how it was interpeting the parameter for the method.
The rules are below. You will notice the call to castToLicenseModel in both, the code in this method is a simple system out that says success. The first rule is succesful the second throws and ExecuteException. Also if I change the parameter of the castToLicenesModel method to the AuditTrail Object and call it from both rules instantiating a new AuditTrail, the first on fails and the second one succeeds. Any help would be appreciated as I am not sure why there would be a difference.
RULE LicenseProcessWriteFileErrorsRule1
CLASS com.creativesolutions.ems.license.ejb.LicenseCompositeEJB
HELPER com.creativesolutions.ems.brw.byteman.helper.EMSBytemanHelper
METHOD testMethod(AuditTrail)
AT ENTRY
BIND engine:com.creativesolutions.ems.entityBean.model.AuditTrail = $1;
IF true
DO System.out.println("Testing 1");
castToLicenseModel(new com.creativesolutions.ems.license.LicenseFile())
ENDRULE
RULE LicenseProcessWriteFileErrorsRule
CLASS com.creativesolutions.ems.license.model.LicenseModel
HELPER com.creativesolutions.ems.brw.byteman.helper.EMSBytemanHelper
METHOD setLicenseFile(LicenseFile)
BIND engine:com.creativesolutions.ems.license.LicenseFile = $1;
IF true
DO System.out.println("Testing 2");
castToLicenseModel(new com.creativesolutions.ems.license.LicenseFile())
ENDRULE
Sorry it is a wrapped exception trace. Looks like an illegalargumentexception is being thrown, see the bottom of the trace
The firm is 295212
org.jboss.byteman.rule.exception.ExecuteException: MethodExpression.interpret : exception invoking method castToLicenseModel file C:\Byteman\LicensingExceptionRules.btm line 19
at org.jboss.byteman.rule.expression.MethodExpression.interpret(MethodExpression.java:353)
at org.jboss.byteman.rule.Action.interpret(Action.java:144)
at com.creativesolutions.ems.brw.byteman.helper.EMSBytemanHelper_HelperAdapter_Interpreted_2.fire(LicensingExceptionRules.btm)
at com.creativesolutions.ems.brw.byteman.helper.EMSBytemanHelper_HelperAdapter_Interpreted_2.execute0(LicensingExceptionRules.btm)
at com.creativesolutions.ems.brw.byteman.helper.EMSBytemanHelper_HelperAdapter_Interpreted_2.execute(LicensingExceptionRules.btm)
at org.jboss.byteman.rule.Rule.execute(Rule.java:684)
at org.jboss.byteman.rule.Rule.execute(Rule.java:653)
at com.creativesolutions.ems.license.model.LicenseModel.setLicenseFile(LicenseModel.java)
at com.creativesolutions.ems.license.ejb.LicenseCompositeEJB.getPreparerDetailsAndCreateLicense(LicenseCompositeEJB.java:2133)
at com.creativesolutions.ems.license.ejb.LicenseCompositeEJB.producePreparerLicense(LicenseCompositeEJB.java:2094)
at com.creativesolutions.ems.license.ejb.LicenseCompositeEJB.processTaxDSWFamilyInfo(LicenseCompositeEJB.java:2862)
at com.creativesolutions.ems.license.ejb.LicenseCompositeEJB.compileLicenseBlock(LicenseCompositeEJB.java:3072)
at com.creativesolutions.ems.license.ejb.LicenseCompositeEJB.produceProductVersionLicenseAddOnTaxLicenses(LicenseCompositeEJB.java:1866)
at com.creativesolutions.ems.license.ejb.LicenseCompositeEJB.processTaxFamilyInfo(LicenseCompositeEJB.java:1903)
at com.creativesolutions.ems.license.ejb.LicenseCompositeEJB.processTaxDSWFamilyInfo(LicenseCompositeEJB.java:2857)
at com.creativesolutions.ems.license.ejb.LicenseCompositeEJB.compileLicenseBlock(LicenseCompositeEJB.java:3072)
at com.creativesolutions.ems.license.ejb.LicenseCompositeEJB.getFirmDetailsAndCreateLicenses(LicenseCompositeEJB.java:1248)
at com.creativesolutions.ems.license.ejb.LicenseCompositeEJB.produceLicense(LicenseCompositeEJB.java:3819)
at com.creativesolutions.ems.license.ejb.LicenseCompositeEJB.startGenerationOfLicensesByFirm(LicenseCompositeEJB.java:3605)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:233)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:404)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:268)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:167)
at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:84)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
at org.jboss.ejb.Container.invoke(Container.java:1092)
at sun.reflect.GeneratedMethodAccessor365.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:260)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:246)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.ejb.SecurityContextInterceptor.invoke(SecurityContextInterceptor.java:64)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:68)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101)
at com.sun.proxy.$Proxy1603.startGenerationOfLicensesByFirm(Unknown Source)
at com.creativesolutions.ems.license.ejb.LicenseGeneratorEJB.generateLicenses(LicenseGeneratorEJB.java:403)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:233)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:268)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:167)
at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:84)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
at org.jboss.ejb.Container.invoke(Container.java:1092)
at sun.reflect.GeneratedMethodAccessor365.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:260)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:246)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.ejb.SecurityContextInterceptor.invoke(SecurityContextInterceptor.java:64)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:68)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101)
at com.sun.proxy.$Proxy1254.generateLicenses(Unknown Source)
at com.creativesolutions.ems.licenseDisk.LicenseDiskControllerBean.startLicenseGeneration(LicenseDiskControllerBean.java:238)
at com.creativesolutions.ems.licenseDisk.LicenseDiskControllerBean.generateLicenseFilesForFirm(LicenseDiskControllerBean.java:300)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:233)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:268)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:167)
at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:84)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
at org.jboss.ejb.Container.invoke(Container.java:1092)
at sun.reflect.GeneratedMethodAccessor365.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.invocation.unified.server.UnifiedInvoker.invoke(UnifiedInvoker.java:232)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:967)
at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:791)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:744)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:586)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)
Caused by: java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.byteman.rule.expression.MethodExpression.interpret(MethodExpression.java:342)
... 131 more
Message was edited by: Brian Mondeau