4 Replies Latest reply on Oct 20, 2015 2:44 PM by radek.koubsky

    Rule throws java.lang.ClassCastException

    radek.koubsky

      Hi,

      one of my rules throws java.lang.ClassCastException when it is triggered.

       

      Byteman 3.0.2-SNAPSHOT

      wildfly-8.2.0.Final

      source code: https://github.com/wildfly/wildfly/blob/8.x/ejb3/src/main/java/org/jboss/as/ejb3/component/stateful/StatefulSessionSynchronizationInterceptor.java

       

      Method:

      @Override
          public Object processInvocation(final InterceptorContext context) throws Exception {
              final StatefulSessionComponent component = getComponent(context, StatefulSessionComponent.class);
              final StatefulSessionComponentInstance instance = getComponentInstance(context);
      
      
              final OwnableReentrantLock lock = instance.getLock();
              final Object threadLock = instance.getThreadLock();
      
      
              final TransactionSynchronizationRegistry transactionSynchronizationRegistry = component.getTransactionSynchronizationRegistry();
              final Object lockOwner = getLockOwner(transactionSynchronizationRegistry);
              lock.pushOwner(lockOwner);
              try {
                  final AccessTimeoutDetails timeout = component.getAccessTimeout(context.getMethod());
                  if (ROOT_LOGGER.isTraceEnabled()) {
                      ROOT_LOGGER.trace("Trying to acquire lock: " + lock + " for stateful component instance: " + instance + " during invocation: " + context);
                  }
                  // we obtain a lock in this synchronization interceptor because the lock needs to be tied to the synchronization
                  // so that it can released on the tx synchronization callbacks
                  boolean acquired = lock.tryLock(timeout.getValue(), timeout.getTimeUnit());
                  if (!acquired) {
                      throw MESSAGES.failToObtainLock(context, timeout.getValue(), timeout.getTimeUnit());
                  }
                  synchronized (threadLock) {
                      if (ROOT_LOGGER.isTraceEnabled()) {
                          ROOT_LOGGER.trace("Acquired lock: " + lock + " for stateful component instance: " + instance + " during invocation: " + context);
                      }
      
      
                      Object currentTransactionKey = null;
                      boolean wasTxSyncRegistered = false;
                      try {
                          //we never register a sync for bean managed transactions
                          //the inner BMT interceptor is going to setup the correct transaction anyway
                          //so enrolling in an existing transaction is not correct
                          if(containerManagedTransactions) {
                              if (!instance.isSynchronizationRegistered()) {
                                  // get the key to current transaction associated with this thread
                                  currentTransactionKey = transactionSynchronizationRegistry.getTransactionKey();
                                  final int status = transactionSynchronizationRegistry.getTransactionStatus();
                                  // if this SFSB instance is already associated with a different transaction, then it's an error
                                  // if the thread is currently associated with a tx, then register a tx synchronization
                                  if (currentTransactionKey != null && status != Status.STATUS_COMMITTED && status != Status.STATUS_ROLLEDBACK) {
                                      // register a tx synchronization for this SFSB instance
                                      final Synchronization statefulSessionSync = new StatefulSessionSynchronization(instance, lockOwner);
                                      transactionSynchronizationRegistry.registerInterposedSynchronization(statefulSessionSync);
                                      wasTxSyncRegistered = true;
                                      if (ROOT_LOGGER.isTraceEnabled()) {
                                          ROOT_LOGGER.trace("Registered tx synchronization: " + statefulSessionSync + " for tx: " + currentTransactionKey +
                                                  " associated with stateful component instance: " + instance);
                                      }
                                      // invoke the afterBegin callback on the SFSB
                                      instance.afterBegin();
                                      instance.setSynchronizationRegistered(true);
                                      context.putPrivateData(StatefulTransactionMarker.class, StatefulTransactionMarker.of(true));
                                  }
                              } else {
                                  context.putPrivateData(StatefulTransactionMarker.class, StatefulTransactionMarker.of(false));
                              }
                          }
                          // proceed with the invocation
                          return context.proceed();
      
      
                      } finally {
                          // if the current call did *not* register a tx SessionSynchronization, then we have to explicitly mark the
                          // SFSB instance as "no longer in use". If it registered a tx SessionSynchronization, then releasing the lock is
                          // taken care off by a tx synchronization callbacks.
                          if (!wasTxSyncRegistered && !instance.isSynchronizationRegistered()) {
                              releaseInstance(instance);
                          } else if (!wasTxSyncRegistered) {
                              //if we don't release the lock here then it will be acquired multiple times
                              //and only released once
                              releaseLock(instance);
                              //we also call the cache release to decrease the usage count
                              if (!instance.isDiscarded()) {
                                  instance.getComponent().getCache().release(instance);
                              }
                          }
                      }
                  }
              } finally {
                  lock.popOwner();
              }
          }
      

       

      Rule:

      #Log StatefulSessionSynchronizationInterceptor - lock acquired
      RULE logStatefulSessionSynchronizationInterceptor.processInvocation.lockAcquired
      CLASS org.jboss.as.ejb3.component.stateful.StatefulSessionSynchronizationInterceptor
      METHOD processInvocation(InterceptorContext)
      AFTER WRITE $acquired
      IF $acquired
      DO log($CLASS, "DEBUG", "(Method processInvocation) The lock is acquired, entering synchronized block with thread lock as monitor object.")
      ENDRULE
      

       

      When rule is triggered, it throws class cast exception.

       

      I have similar rule which uses AFTER WRITE $acquired:

      #Log StatefulSessionSynchronizationInterceptor - trying to acquire a lock
      RULE logStatefulSessionSynchronizationInterceptor.processInvocation.tryAcquire
      CLASS org.jboss.as.ejb3.component.stateful.StatefulSessionSynchronizationInterceptor
      METHOD processInvocation(InterceptorContext)
      AFTER WRITE $acquired
      IF true
      DO log($CLASS, "DEBUG", "(Method processInvocation) Trying to acquire the lock within given time, time: " + $timeout.getValue() + "; unit: " + 
        $timeout.getTimeUnit())
      ENDRULE
      

       

      Only difference is that the class cast exception rule uses "IF $acquired".

       

      Stacktrace from class cast exception:

      01:57:17,565 INFO  [stdout] (default task-7) cast exception org.jboss.byteman.koubsky.LogHelper_HelperAdapter_Interpreted_13

      01:57:17,565 INFO  [stdout] (default task-7) java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Boolean

      01:57:17,566 INFO  [stdout] (default task-7) at org.jboss.byteman.rule.Condition.interpret(Condition.java:116)

      01:57:17,566 INFO  [stdout] (default task-7) at org.jboss.byteman.koubsky.LogHelper_HelperAdapter_Interpreted_13.test(ejb.btm)

      01:57:17,566 INFO  [stdout] (default task-7) at org.jboss.byteman.koubsky.LogHelper_HelperAdapter_Interpreted_13.execute0(ejb.btm)

      01:57:17,567 INFO  [stdout] (default task-7) at org.jboss.byteman.koubsky.LogHelper_HelperAdapter_Interpreted_13.execute(ejb.btm)

      01:57:17,567 INFO  [stdout] (default task-7) at org.jboss.byteman.rule.Rule.execute(Rule.java:684)

      01:57:17,567 INFO  [stdout] (default task-7) at org.jboss.byteman.rule.Rule.execute(Rule.java:653)

      01:57:17,568 INFO  [stdout] (default task-7) at org.jboss.as.ejb3.component.stateful.StatefulSessionSynchronizationInterceptor.processInvocation(StatefulSessionSynchronizationInterceptor.java:87)

      01:57:17,568 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,568 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:407)

      01:57:17,568 INFO  [stdout] (default task-7) at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:46)

      01:57:17,569 INFO  [stdout] (default task-7) at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)

      01:57:17,569 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,569 INFO  [stdout] (default task-7) at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)

      01:57:17,570 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,570 INFO  [stdout] (default task-7) at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

      01:57:17,570 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,570 INFO  [stdout] (default task-7) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

      01:57:17,571 INFO  [stdout] (default task-7) at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)

      01:57:17,571 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,571 INFO  [stdout] (default task-7) at org.jboss.as.ejb3.component.stateful.StatefulComponentInstanceInterceptor.processInvocation(StatefulComponentInstanceInterceptor.java:66)

      01:57:17,572 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,572 INFO  [stdout] (default task-7) at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:273)

      01:57:17,573 INFO  [stdout] (default task-7) at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:340)

      01:57:17,573 INFO  [stdout] (default task-7) at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)

      01:57:17,573 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,574 INFO  [stdout] (default task-7) at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

      01:57:17,574 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,574 INFO  [stdout] (default task-7) at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43)

      01:57:17,574 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,575 INFO  [stdout] (default task-7) at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:95)

      01:57:17,575 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,575 INFO  [stdout] (default task-7) at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)

      01:57:17,575 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,576 INFO  [stdout] (default task-7) at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)

      01:57:17,576 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,576 INFO  [stdout] (default task-7) at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

      01:57:17,576 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,577 INFO  [stdout] (default task-7) at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55)

      01:57:17,577 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,577 INFO  [stdout] (default task-7) at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)

      01:57:17,577 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,577 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326)

      01:57:17,578 INFO  [stdout] (default task-7) at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:448)

      01:57:17,578 INFO  [stdout] (default task-7) at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)

      01:57:17,578 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,578 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326)

      01:57:17,578 INFO  [stdout] (default task-7) at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)

      01:57:17,578 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,578 INFO  [stdout] (default task-7) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

      01:57:17,578 INFO  [stdout] (default task-7) at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:185)

      01:57:17,579 INFO  [stdout] (default task-7) at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182)

      01:57:17,579 INFO  [stdout] (default task-7) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

      01:57:17,579 INFO  [stdout] (default task-7) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

      01:57:17,579 INFO  [stdout] (default task-7) at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)

      01:57:17,579 INFO  [stdout] (default task-7) at org.jboss.as.quickstarts.ear.ejb.GreeterEJB$$$view2.sayHello(Unknown Source)

      01:57:17,579 INFO  [stdout] (default task-7) at org.jboss.as.quickstarts.ear.controller.Greeter.setName(Greeter.java:55)

      01:57:17,579 INFO  [stdout] (default task-7) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      01:57:17,579 INFO  [stdout] (default task-7) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      01:57:17,580 INFO  [stdout] (default task-7) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      01:57:17,580 INFO  [stdout] (default task-7) at java.lang.reflect.Method.invoke(Method.java:606)

      01:57:17,580 INFO  [stdout] (default task-7) at javax.el.ELUtil.invokeMethod(ELUtil.java:308)

      01:57:17,580 INFO  [stdout] (default task-7) at javax.el.BeanELResolver.invoke(BeanELResolver.java:537)

      01:57:17,580 INFO  [stdout] (default task-7) at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)

      01:57:17,580 INFO  [stdout] (default task-7) at com.sun.el.parser.AstValue.invoke(AstValue.java:286)

      01:57:17,580 INFO  [stdout] (default task-7) at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)

      01:57:17,580 INFO  [stdout] (default task-7) at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)

      01:57:17,581 INFO  [stdout] (default task-7) at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)

      01:57:17,581 INFO  [stdout] (default task-7) at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)

      01:57:17,581 INFO  [stdout] (default task-7) at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)

      01:57:17,581 INFO  [stdout] (default task-7) at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)

      01:57:17,581 INFO  [stdout] (default task-7) at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)

      01:57:17,581 INFO  [stdout] (default task-7) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)

      01:57:17,581 INFO  [stdout] (default task-7) at javax.faces.component.UICommand.broadcast(UICommand.java:315)

      01:57:17,582 INFO  [stdout] (default task-7) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)

      01:57:17,582 INFO  [stdout] (default task-7) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)

      01:57:17,582 INFO  [stdout] (default task-7) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)

      01:57:17,582 INFO  [stdout] (default task-7) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

      01:57:17,582 INFO  [stdout] (default task-7) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)

      01:57:17,582 INFO  [stdout] (default task-7) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)

      01:57:17,582 INFO  [stdout] (default task-7) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)

      01:57:17,582 INFO  [stdout] (default task-7) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)

      01:57:17,583 INFO  [stdout] (default task-7) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

      01:57:17,583 INFO  [stdout] (default task-7) at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

      01:57:17,583 INFO  [stdout] (default task-7) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

      01:57:17,583 INFO  [stdout] (default task-7) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)

      01:57:17,583 INFO  [stdout] (default task-7) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)

      01:57:17,583 INFO  [stdout] (default task-7) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

      01:57:17,583 INFO  [stdout] (default task-7) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)

      01:57:17,583 INFO  [stdout] (default task-7) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63)

      01:57:17,584 INFO  [stdout] (default task-7) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)

      01:57:17,584 INFO  [stdout] (default task-7) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)

      01:57:17,584 INFO  [stdout] (default task-7) at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)

      01:57:17,584 INFO  [stdout] (default task-7) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

      01:57:17,584 INFO  [stdout] (default task-7) at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

      01:57:17,584 INFO  [stdout] (default task-7) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

      01:57:17,584 INFO  [stdout] (default task-7) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

      01:57:17,585 INFO  [stdout] (default task-7) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261)

      01:57:17,585 INFO  [stdout] (default task-7) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247)

      01:57:17,585 INFO  [stdout] (default task-7) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76)

      01:57:17,585 INFO  [stdout] (default task-7) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166)

      01:57:17,586 INFO  [stdout] (default task-7) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197)

      01:57:17,586 INFO  [stdout] (default task-7) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759)

      01:57:17,586 INFO  [stdout] (default task-7) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

      01:57:17,586 INFO  [stdout] (default task-7) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

      01:57:17,587 INFO  [stdout] (default task-7) at java.lang.Thread.run(Thread.java:745)

       

      Thank you for help.

        • 1. Re: Rule throws java.lang.ClassCastException
          adinn

          Hi Radek,

           

          Ooh, nice bug!

           

          I don't know why Byteman thinks that the value of the condition $acquired is an Integer when it is clearly a boolean local variable. I'll need to reproduce this in order to see what is going wrong. Could you provide instructions explaining how to recreate your wildfly setup and get it to execute the code which triggers this rule? Thanks.

           

          regards,

           

           

          Andrew Dinn

          • 2. Re: Rule throws java.lang.ClassCastException
            radek.koubsky

            Hi,

            I assume you know how to setup byteman and configure wildfly. You need to:

            donwload byteman 3.0.2 (you sent me link to sonatype repo, I downloaded byteman-download-3.0.2-20151001.094023-2-full.zip)

            download wildfly-8.2.0.Final (there is only 8.2.1 version on their website, I can send you my local version, if you want)

            download my source code from RadekKoubsky/byteman-wildfly-log · GitHub

            run mvn clean package

            configure wildfly, I can attach my standalone.conf file

             

            As you can see in conf file, I use only ejb.btm rules from github

            I test them with wildfly ejb quickstart 8.x version, just go to greeter.jsf and send the form quickstart/ejb-in-ear at 8.x · wildfly/quickstart · GitHub

            I run wildlfy from command line by standalone.sh

            Good luck with all these steps!

            • 3. Re: Rule throws java.lang.ClassCastException
              adinn

              Hi Radek,

               

              I raised BYTEMAN-298 https://issues.jboss.org/browse/BYTEMAN-298 for this bug. The problem is that the injection code is tracking the presence of local variables and their types by monitoring xload and xstore bytecode insructions. A boolean constant is initialised using an istore instruction because the JVM represents booleans on the stack using int values 0 and 1. So, the code which passes he arary of objects ot the rule engine is reading an iont out of the local var slot and boxing it as an Integer. I special cased the local var load/store rutines so that when they pull a value out of an int slot (or store the value back on return from executing rule code) they check the descriptor for the local var and box to a Boolean (or unbox from a Boolean) when the local var descriptor is "boolean". This fixes the problem when I run your Widlfly example.

               

              I'll push the patch ready to go into 3.0.2.

               

              Thanks very much for finding and rpeorting this bug and the other bugs you have found.You wil be name-checked in the release notes :-)

              • 4. Re: Rule throws java.lang.ClassCastException
                radek.koubsky

                Hi,

                thank you for the bug fix. I am glad to help you or anybody else in OS community, the result is worth it:)