0 Replies Latest reply on Aug 5, 2014 8:03 PM by Larry O'Leary

    ExecuteException: MethodExpression.interpret when referencing Entity EJB

    Larry O'Leary Newbie

      I am struggling with a very strange Byteman exception that I just can't understand. My rule is simple but I have to use a custom helper method so that I can extract the specific elements from a Map:

       

      RULE trace EventManagerBean addEventData events map
      CLASS org.rhq.enterprise.server.event.EventManagerBean
      METHOD addEventData
      HELPER helpers.EventsHelper
      AT ENTRY
      IF TRUE
      DO traceEventMap($1)
      ENDRULE
      

       

      $1 will be of type Map<EventSource, Set<Event>>. The helper class:

       

      package helpers;
      
      import java.util.Map;
      import java.util.Set;
      
      import org.jboss.byteman.rule.Rule;
      import org.jboss.byteman.rule.helper.Helper;
      import org.rhq.core.domain.event.Event;
      import org.rhq.core.domain.event.EventSource;
      import org.rhq.core.domain.resource.Resource;
      
      public class EventsHelper extends Helper {
      
          protected EventsHelper(Rule rule) {
              super(rule);
          }
      
          public boolean traceEventMap(Map events) {
              Resource res = new Resource(12345);
              return traceln("I am returning...");
          }
      
      }
      

       

      When the rule is triggered, the helper method fails and the following is all that is output:

      Rule.execute called for trace EventManagerBean addEventData events map_0
      org.jboss.byteman.agent.Transformer : Saving transformed bytes to /tmp/JBM/bmdump/helpers/EventsHelper_HelperAdapter_Interpreted_1.class
      HelperManager.install for helper class helpers.EventsHelper
      calling activated() for helper class helpers.EventsHelper
      Default helper activated
      calling installed(trace EventManagerBean addEventData events map) for helper classhelpers.EventsHelper
      Installed rule using default helper : trace EventManagerBean addEventData events map
      trace EventManagerBean addEventData events map execute()
      trace EventManagerBean addEventData events map : org.jboss.byteman.rule.exception.ExecuteException: MethodExpression.interpret : exception invoking method traceEventMap file /tmp/JBM/rules/BZ1110277.btm line 24
      caught ExecuteException
      
      

      I have tracked this down to the line 19 of the EventsHelper.java. If I comment out the line that reads:

       

              Resource res = new Resource(12345);
      

      The helper method returns just fine and the exception goes away.

       

      Any thoughts on what is going on here? If I put this same code into a Main method and invoke it directly, all is fine.