0 Replies Latest reply on Dec 29, 2014 2:39 AM by Hristo Stoyanov

    Wildfly 8.2 Infinispan cache and JTA transactions issues

    Hristo Stoyanov Master

      Hi,

      I am getting sporadic exception while using the WildFly 8.2.0 built-in Infinispan cache - what could be the cause for these?

       

      23:28:38,117 ERROR [org.infinispan.interceptors.InvocationContextInterceptor] (transport-thread-10) ISPN000136: Execution error: java.lang.IllegalStateException: Transaction TransactionImple < ac, BasicAction: 0:ffff7f000001:2c2d3011:54a101bd:88 status: ActionStatus.COMMITTED > is not in a valid state to be invoking cache operations on.

        at org.infinispan.interceptors.TxInterceptor.enlist(TxInterceptor.java:275) [infinispan-core-6.0.2.Final.jar:6.0.2.Final]

        at org.infinispan.interceptors.TxInterceptor.enlistWriteAndInvokeNext(TxInterceptor.java:240) [infinispan-core-6.0.2.Final.jar:6.0.2.Final]

        at org.infinispan.interceptors.TxInterceptor.visitPutKeyValueCommand(TxInterceptor.java:186) [infinispan-core-6.0.2.Final.jar:6.0.2.Final]

        at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:70) [infinispan-core-6.0.2.Final.jar:6.0.2.Final]

       

       

      Here is how I configure my cache:

       

      <subsystem xmlns="urn:jboss:domain:infinispan:2.0">

                  <cache-container name="S4GCacheContainer" default-cache="S4GLocalCache">

                      <local-cache name="S4GLocalCache">

                         <transaction mode="NON_XA"/>

                          <eviction strategy="LRU" max-entries="5000"/>

                          <expiration lifespan="86400000"/>

                          <file-store passivation="true" purge="true"/>

                      </local-cache>

      </subsystem>

       

       

      And I put entries in the cache within a transactional EJB method, for example:

      ...

          @Resource(lookup = CACHE_CONTAINER_JNDI)

          private EmbeddedCacheManager cacheManager;

          private Cache<String, Object> cache;

       

          @PostConstruct

          protected void initCache() {

              cache = cacheManager.getCache();

          }

       

         @Override

         @TransactionAttribute(TransactionAttributeType.REQUIRED)    public List<DetailDTO> inspect(String symbols) {

             ...

            AtomicMap<String, Object> map = AtomicMapLookup.getAtomicMap(cache, userId);

            map.put(getSymbolInspect(detailDto.getSymbol()), detailDto);

            ...

          }