I am trying to use Infinispan as Hibernate L2 cache for an application which use technologies like Tomcat 6, Hibernate 4 and Spring 3.5. The application running in Tomcat and our current transaction manager is
org.springframework.orm.hibernate4.HibernateTransactionManager
We have introduced following properties to hibernate property file for Infinispan introduction.
hibernate.cache.region.factory_class=org.hibernate.cache.infinispan.InfinispanRegionFactory
hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory
hibernate.transaction.jta.platform=org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform
hibernate.transaction.manager_lookup_class=org.hibernate.cache.infinispan.tm.HibernateTransactionManagerLookup
After the introduction of Infinispan we lost the stability of the application and start to get different errors randomly. I assume our Infinispan configurations are not correct (we use a transnational cache). I think our transaction manager and Infinispan transaction settings not match. Please advice for correct configuration.
Errors we see
java.lang.IllegalStateException: Transaction TransactionImple < ac, BasicAction: 0:ffff0a1e015a:c2f8:51921dac:3de status: ActionStatus.ABORTED > is not in a valid state to be invoking cache operations on.
org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction
Infinispan configuration file I use
<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:infinispan:config:5.1"
xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd">
<global>
<globalJmxStatistics enabled="true" jmxDomain="org.infinispan" allowDuplicateDomains="true"/>
<transport
transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport"
clusterName="infinispan-hibernate-cluster"
distributedSyncTimeout="50000"
strictPeerToPeer="false">
<properties>
<property name="configurationFile" value="jgroups.xml"/>
</properties>
</transport>
</global>
<default>
</default>
<namedCache name="aaa-replicated-cache-entity">
<clustering mode="replication">
<stateRetrieval fetchInMemoryState="false" timeout="60000"/>
<sync replTimeout="20000"/>
</clustering>
<locking isolationLevel="READ_COMMITTED" concurrencyLevel="1000"
lockAcquisitionTimeout="15000" useLockStriping="false"/>
<eviction maxEntries="10000" strategy="LRU"/>
<expiration maxIdle="100000" wakeUpInterval="5000"/>
<lazyDeserialization enabled="true"/>
<transaction useSynchronization="true"
transactionMode="TRANSACTIONAL" autoCommit="false"
lockingMode="OPTIMISTIC"/>
<loaders passivation="false" shared="false" preload="false">
<loader class="org.infinispan.loaders.cluster.ClusterCacheLoader"
fetchPersistentState="false"
ignoreModifications="false" purgeOnStartup="false">
<properties>
<property name="remoteCallTimeout" value="20000"/>
</properties>
</loader>
</loaders>
</namedCache>
</infinispan>
Thanks