0 Replies Latest reply on Nov 6, 2013 6:07 PM by surreption

    Configuring Infinispan as Transactional Cache for application within WebSphere

    surreption Newbie

      I am working on an application that uses Spring 3.2.3.RELEASE, Hibernate 4.1.12.Final and Infinispan 5.2.1.Final. The application must supports various application containers such as JBoss, Web Logic, and WebSphere. We are using the JtaPlatform from Hibernate and the JtaTransactionManager from Spring for each container.

       

      ContainerJtaPlatformJtaTransactionManager
      JBossJBossAppServerJtaPlatformJtaTransactionManager
      Web LogicWeblogicJtaPlatformWebLogicJtaTransactionManager
      WebSphereWebSphereExtendedJtaPlatformWebSphereUowTransactionManager

       

      When I pull in Inifinispan as a transactional L2 cache, the application fails to start within WebSphere.  It appears that the initialization of the entity caches is attempting to locate and use the TransactionManager to do a suspend and resume of the transaction. In this configuration, the transactionManager is found from the JtaPlatform mentioned above. This transactionManager throws an UnsupportedOperation on suspend and on resume calls. See stack trace below:

       

      I have attempted to specify the transactionManagerLookup in the configuration { transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"} without seeing any change in behavior. Looking at the InfinispanRegionFactory# configureTransactionManager it looks like the transactionManager is going to be the HibernateTransactionManagerLookup.

       

      Question

      Is there a configuration option that would allow me to not use the transactionManager from Hibernate for Infinispan or to otherwise Infinispan as a transactional cache with WebSphere and the Hibernate?

       

       

      Here is the stack trace I mentioned:

       

                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)

                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)

                      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)

                      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)

                      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)

                      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)

                      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)

                      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922)

                      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)

                      at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

                      at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)

                      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56)

                      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)

                      at java.lang.reflect.Constructor.newInstance(Constructor.java:527)

                      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)

                      ... 39 more

      Caused by: org.infinispan.CacheException: Unable to invoke method public void org.infinispan.loaders.CacheLoaderManagerImpl.start() on object of type CacheLoaderManagerImpl

                      at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:205)

                      at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:883)

                      at org.infinispan.factories.AbstractComponentRegistry.invokeStartMethods(AbstractComponentRegistry.java:654)

                      at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:643)

                      at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:546)

                      at org.infinispan.factories.ComponentRegistry.start(ComponentRegistry.java:199)

                      at org.infinispan.CacheImpl.start(CacheImpl.java:559)

                      at org.infinispan.manager.DefaultCacheManager.wireAndStartCache(DefaultCacheManager.java:686)

                      at org.infinispan.manager.DefaultCacheManager.createCache(DefaultCacheManager.java:649)

                      at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:545)

                      at org.hibernate.cache.infinispan.InfinispanRegionFactory.getCache(InfinispanRegionFactory.java:526)

                      at org.hibernate.cache.infinispan.InfinispanRegionFactory.buildEntityRegion(InfinispanRegionFactory.java:216)

                      at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:346)

                      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1754)

                      at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)

                      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)

                      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)

                      at <proprietary classes>

                      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:288)

                      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)

                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)

                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)

                      ... 55 more

      Caused by: org.infinispan.CacheException: Unable to start cache loaders

                      at org.infinispan.loaders.CacheLoaderManagerImpl.start(CacheLoaderManagerImpl.java:160)

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)

                      at java.lang.reflect.Method.invoke(Method.java:611)

                      at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:203)

                      ... 77 more

      Caused by: java.lang.UnsupportedOperationException

                      at org.hibernate.service.jta.platform.internal.WebSphereExtendedJtaPlatform$TransactionManagerAdapter.suspend(WebSphereExtendedJtaPlatform.java:149)

                      at org.infinispan.loaders.CacheLoaderManagerImpl.start(CacheLoaderManagerImpl.java:149)