2 Replies Latest reply on Sep 29, 2014 8:08 AM by Tomohisa igarashi

    Helper hits "argument type mismatch" on EAP

    Tomohisa igarashi Master

      Hi, I'm struggling to use Byteman with my helper class on EAP. I hit two problems:

       

      • All of jars helper class depends on must be listed in -javaagent argument with sys: prefix
        • For example, when your rule introspects com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple#enlistResource(XAResource,Object[]) and your helper receives TransactionImple object as a parameter, then sys:/path/to/jbossjts-jacorb.jar must be in the argument.
      • "IllegalArgumentException: argument type mismatch" is thrown
        • Even if you list the jar as above, helper hits this error due to the TransactionImple object can't be recognized as a expected class type. I guess this is caused by the class loader difference, the helper class is loaded by sys loader but the class for actual TransactionImple object is loaded by jbossts module loader.

       

      Does anyone hit this problem and found any solution? I gave up to use helper class and write all action into rule file for now. It doesn't hit above two, so a bit better than receiving all of arguments as Object and use reflection, or serialize/deseriarlize those.

       

      Thanks,

      Tomo

        • 1. Re: Helper hits "argument type mismatch" on EAP
          Andrew Dinn Master

          Hi Tomo,

           

          This is a known problem with the current operation of Byteman.

           

          The solution requires an upgrade to Byteman in 2 separate steps.

           

          • The rule language needs to be modified to support an import statement in rule scripts.
          • The rule engine needs to be modified to link rule code by delegating to the loaders for imported classes as well as delegating to the loader for the rule's target class

           

          This really needs to be provided using a plugin model so we can implement each step (import processing and loader delegation) for vanilla JDK and also for Jigsaw, JBoss Modules and OSGi. Clearly, each plugin will need to define an appropriate import syntax and appropriate semantics for how to handle delegation.

           

          I have some ideas for how to provide such an implementation but I don't have time at present to do this myself. If you or anyone else are interested in implementing such a solution I'd be happy to try to help get it working.

          • 2. Re: Helper hits "argument type mismatch" on EAP
            Tomohisa igarashi Master

            Hi Andrew,

            Thanks for the clear answer! Contributing for it sounds interesting, but I'm just an user right now, so will need some time to get familiar with the inside of Byteman. That'll be great if somebody else can do before me