2 Replies Latest reply on Jun 6, 2012 10:37 AM by Jeremy Whiting

    Problem using callerEquals in rule.

    Jeremy Whiting Expert

      Hi,

      I have a rule to check the call stack. When it equals a caller in the stack byteman will print a debug message.

      I am finding the boolean condition callerEquals is not true as expected.

       

      This is my rule

       

      RULE Initialise customer association

      CLASS org.spec.jent.ejb.orders.entity.Customer

      METHOD getInventories

      AT EXIT

      IF callerEquals("CustomerSession.getInventories")

      DO debug("caller equals");

      ENDRULE

       

      I also tried this helper method.

       

      IF callerEquals("CustomerSession.getInventories", 10)

       

       

      This is the call stack

       

      11:22:05,668 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) Stack trace for thread http-localhost/127.0.0.1:8080-3

      11:22:05,669 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.spec.jent.ejb.orders.entity.Customer.getInventories(Customer.java:209)

      11:22:05,669 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.spec.jent.ejb.orders.session.CustomerSession.getInventories(CustomerSession.java:93)

      11:22:05,669 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)

      11:22:05,669 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      11:22:05,669 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      11:22:05,669 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) java.lang.reflect.Method.invoke(Method.java:616)

      11:22:05,669 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)

      11:22:05,669 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:22:05,669 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

      11:22:05,669 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36)

      11:22:05,669 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:22:05,669 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)

      11:22:05,669 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:22:05,670 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)

      11:22:05,670 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:22:05,670 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

      11:22:05,670 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:22:05,670 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

      11:22:05,670 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)

      11:22:05,670 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:22:05,670 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)

      11:22:05,670 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:22:05,670 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInNoTx(CMTTxInterceptor.java:210)

      11:22:05,670 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ejb3.tx.CMTTxInterceptor.supports(CMTTxInterceptor.java:362)

      11:22:05,670 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:193)

      11:22:05,670 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:22:05,670 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

      11:22:05,671 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:22:05,671 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:42)

      11:22:05,671 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:22:05,671 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)

      11:22:05,671 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:22:05,671 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

      11:22:05,671 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:22:05,671 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32)

      11:22:05,671 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:22:05,671 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)

      11:22:05,671 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:22:05,671 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

      11:22:05,671 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)

      11:22:05,672 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:176)

      11:22:05,672 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:22:05,672 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

      11:22:05,672 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)

      11:22:05,672 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.spec.jent.ejb.orders.session.CustomerSessionLocal$$$view12.getInventories (Unknown Source)

      11:22:05,672 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.spec.jent.servlet.helper.SpecAction.getHoldings(SpecAction.java:277)

      11:22:05,672 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.spec.jent.servlet.helper.SpecServletAction.doHome(SpecServletAction.java:281)

      11:22:05,672 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.spec.jent.servlet.helper.SpecServletAction.doLogin(SpecServletAction.java:167)

      11:22:05,672 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.spec.jent.servlet.SpecAppServlet.performTask(SpecAppServlet.java:121)

      11:22:05,672 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.spec.jent.servlet.SpecAppServlet.doGet(SpecAppServlet.java:78)

      11:22:05,672 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) javax.servlet.http.HttpServlet.service(HttpServlet.java:734)

      11:22:05,672 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

      11:22:05,672 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

      11:22:05,672 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

      11:22:05,672 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

      11:22:05,673 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

      11:22:05,673 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)

      11:22:05,673 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

      11:22:05,673 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

      11:22:05,673 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

      11:22:05,673 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

      11:22:05,673 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

      11:22:05,673 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

      11:22:05,673 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679)

      11:22:05,673 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)

      11:22:05,673 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) java.lang.Thread.run(Thread.java:679)

       

      Is my rule defined correctly ?

       

      Regards,

      Jeermy

        • 1. Re: Problem using callerEquals in rule.
          Andrew Dinn Master

          Jeremy Whiting wrote:

           

          This is my rule

           

          RULE Initialise customer association

          CLASS org.spec.jent.ejb.orders.entity.Customer

          METHOD getInventories

          AT EXIT

          IF callerEquals("CustomerSession.getInventories")

          DO debug("caller equals");

          ENDRULE

           

          . . .

           

          Is my rule defined correctly ?

           

          Nope :-)

           

          You want

           

          IF callerEquals("CustomerSession.getInventories", true)

           

          or

           

          IF callerEquals("getInventories")

           

          or maybe even

           

          IF callerEquals("org.spec.jent.ejb.orders.entity.CustomerSession.getInventories", true, true)

           

          The booleans determine whether the class name and package name are prefixed to the method name. If omitted they default to false meaning don't include them.

           

          regards,

           

           

          Andrew Dinn

          • 2. Re: Problem using callerEquals in rule.
            Jeremy Whiting Expert

            Hi Andrew,

            Thank you for correcting my mistake. The problem I was having has been fixed. I have gone onto check a particular stack frame which is very useful.

             

            IF callerEquals("doHome", false, 46, 1)

             

            Many thanks,

            Jeremy