This document describes a workaround for a known issue where a ClassCastException can arise when using WebSphere as an external JTA manager with GemFire.
This issue has been reported with WebSphere 7.0.0.25 as the external JTA manager, but may also occur with other versions. Specifically, when the class-loader policy is 'Application' and the class-loader mode is configured as 'PARENT_LAST' the following error may be seen:
========================================== [warning 2013/12/12 14:32:06.348 EST < Default : 4 > tid=0x7e] JNDIInvoker::doTransactionLookup::Found WebSphere TransactionManager factory class [com.ibm.ws.Transaction.TransactionManagerFactory], but could not invoke its static 'getTransactionManager' method java.lang.ClassCastException: com.ibm.ws.tx.jta.TranManagerSet incompatible with javax.transaction.TransactionManager at com.gemstone.gemfire.internal.jndi.JNDIInvoker.doTransactionLookup(JNDIInvoker.java:277) at com.gemstone.gemfire.internal.jndi.JNDIInvoker.mapTransactions(JNDIInvoker.java:118) at com.gemstone.gemfire.internal.cache.GemFireCacheImpl.< init >(GemFireCacheImpl.java:627) at com.gemstone.gemfire.internal.cache.GemFireCacheImpl.create(GemFireCacheImpl.java:607) at com.gemstone.gemfire.cache.client.ClientCacheFactory.basicCreate(ClientCacheFactory.java:207) at com.gemstone.gemfire.cache.client.ClientCacheFactory.create(ClientCacheFactory.java:162) ===========================================
The root cause is that the javax.transaction API definitions are bundled within the GemFire jar, which is deployed with the webappr, while WebSphere provides its own javax.transaction package. This results in a conflict and the above exception.
Currently, there are two options available to avoid this issue:
zip -d gemfire.jar javax/transaction/*