2 Replies Latest reply on May 25, 2016 9:44 AM by Julien Guillot

    Wildfly 10 infinispan batching

    Julien Guillot Newbie

      Hello,

       

      I'm getting error when using Infinispan Tree Cache API, because invocationBatching is not enabled:

       

      10:24:54,899 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 31) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "test-wfy10-cache-tree.ear-0.0.0-SNAPSHOT.ear")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.subunit.\"test-wfy10-cache-tree.ear-0.0.0-SNAPSHOT.ear\".\"test-wfy10-cache-tree.jar.jar\".component.TreeCacheBean.START" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"test-wfy10-cache-tree.ear-0.0.0-SNAPSHOT.ear\".\"test-wfy10-cache-tree.jar.jar\".component.TreeCacheBean.START: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
          Caused by: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
          Caused by: javax.ejb.EJBException: org.infinispan.commons.CacheConfigurationException: invocationBatching is not enabled for cache 'testCache'. Make sure this is enabled by calling configurationBuilder.invocationBatching().enable()
          Caused by: org.infinispan.commons.CacheConfigurationException: invocationBatching is not enabled for cache 'testCache'. Make sure this is enabled by calling configurationBuilder.invocationBatching().enable()"}}
      10:24:54,899 ERROR [org.jboss.as.server] (management-handler-thread - 31) WFLYSRV0021: Deploy of deployment "test-wfy10-cache-tree.ear-0.0.0-SNAPSHOT.ear" was rolled back with the following failure message: 
      {"WFLYCTL0080: Failed services" => {"jboss.deployment.subunit.\"test-wfy10-cache-tree.ear-0.0.0-SNAPSHOT.ear\".\"test-wfy10-cache-tree.jar.jar\".component.TreeCacheBean.START" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"test-wfy10-cache-tree.ear-0.0.0-SNAPSHOT.ear\".\"test-wfy10-cache-tree.jar.jar\".component.TreeCacheBean.START: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
          Caused by: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
          Caused by: javax.ejb.EJBException: org.infinispan.commons.CacheConfigurationException: invocationBatching is not enabled for cache 'testCache'. Make sure this is enabled by calling configurationBuilder.invocationBatching().enable()
      

       

      cache configuration in standalone.xml is:

       

                  <cache-container name="testContainer" jndi-name="java:jboss/infinispan/container/testContainer">
                      <local-cache name="testCache">
                          <transaction mode="BATCH"/>
                      </local-cache>
                  </cache-container>
      

       

      Application code:

      @Startup
      @Singleton
      public class TreeCacheBean {
        @Resource(lookup = "java:jboss/infinispan/cache/testContainer/testCache")
        private Cache<String, String> testBaseCache;
      
        @PostConstruct
        public void onStartup() {
          new TreeCacheFactory().createTreeCache(this.testBaseCache);
        }
      
      }
      

       

      Isn't <transaction mode="BATCH"/> enough to enable invocationBatching? Or is there something wrong in my code?

       

       

      Full example: GitHub - julien-guillot/test-wfy10-cache-tree: Test Wildfly 10 Infinispan Tree Cache API

        • 1. Re: Wildfly 10 infinispan batching
          Paul Ferraro Master

          As of WildFly 8, <transaction mode="BATCH"/> no longer uses Infinispan's invocation batching, but a custom implementation of the startBatch()/endBatch() cache methods.  Consequently, Configuration.invocationBatchingEnabled() will always return false.

           

          You can still get TreeCache to work by creating a new cache configuration with invocation batching enabled, based on the configuration of testCache.

          e.g.

          @PostConstruct
          public void init() {
             this.testBaseCache.getCacheManager().defineConfiguration("testCacheBatch", new ConfigurationBuilder().read(this.testBaseCache.getCacheConfiguration()).invocationBatching().enable().build());
             TreeCache<?, ?> tree = new TreeCacheFactory().createTreeCache(this.testBaseCache.getCacheManager().getCache("testCacheBatch")); 
          }
          

           

          Given that the tree module is scheduled for deprecation in Infinispan 9, I would encourage you to avoid using it.

          • 2. Re: Wildfly 10 infinispan batching
            Julien Guillot Newbie

            Ok, thanks for the explanation .

             

            It was working with wildfly 8.2, and I never tested with wildfly 9.