1 Reply Latest reply on Jul 1, 2018 10:48 PM by Paul Ferraro

    Configuring infinispan with WildFly 13

    Sergiu Pienar Expert

      I'm trying to setup infinispan as the cache provider. Below is my hibernate.cfg.xml file:

       

      <hibernate-configuration>

      <session-factory name="java:jboss/HibernateFactory">

       

      <property name="connection.datasource">java:jboss/datasources/autoidDSXA</property>

      <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

      <property name="show_sql">false</property>

      <property name="transaction.factory_class">

      org.hibernate.transaction.JTATransactionFactory

      </property>

      <property name="jta.UserTransaction">java:jboss/UserTransaction</property>

      <property name="JndiName">java:jboss/HibernateFactory</property>

      <property name="Datasource">java:jboss/datasources/autoidDSXA</property>

      <property name="Dialect">org.hibernate.dialect.SAPDBDialect</property>

      <property name="ShowSqlEnabled">false</property>

      <property name="UserTransactionName">java:jboss/UserTransaction</property>

      <property name="JdbcBatchSize">0</property>

      <!-- Transaction integration -->

      <property name="TransactionStrategy">org.hibernate.transaction.CMTTransactionFactory</property>

      <property name="TransactionManagerLookupStrategy">org.hibernate.transaction.JBossTransactionManagerLookup</property>

      <property name="FlushBeforeCompletionEnabled">true</property>

      <property name="AutoCloseSessionEnabled">true</property>

       

      <property name="MaximumFetchDepth">5</property>

       

      <property name="SecondLevelCacheEnabled">false</property>

      <property name="QueryCacheEnabled">false</property>

      <!-- <property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>  -->

      <property name="hibernate.cache.region.factory_class">org.infinispan.hibernate.cache.v53.InfinispanRegionFactory</property>

      <!-- mapping files -->

      </session-factory>

      </hibernate-configuration>

      and my hibernate.properties: hibernate.show_sql=false hibernate.format_sql=false hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup hibernate.transaction.flush_before_completion=true hibernate.transaction.auto_close_session=true jta.UserTransaction=java:jboss/UserTransaction hibernate.jdbc.fetch_size=5 hibernate.jdbc.batch_size=0 hibernate.cache.use_second_level_cache=true hibernate.cache.provider_class=org.infinispan.hibernate.cache.v53.InfinispanRegionFactory hibernate.cache.use_query_cache=true hibernate.cache.use_structured_entries=true hibernate.session_factory_name=java:jboss/HibernateFactory

      On startup I'm getting: Caused by: org.hibernate.cache.CacheException: HHH025009: Unable to start region factory at org.infinispan.hibernate.cache.v53.InfinispanRegionFactory.start(InfinispanRegionFactory.java:248) at org.hibernate.cache.internal.EnabledCaching.(EnabledCaching.java:77) at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:33) at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:24) at org.hibernate.service.spi.SessionFactoryServiceInitiator.initiateService(SessionFactoryServiceInitiator.java:30) at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:68) at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263) ... 60 more Caused by: java.lang.NullPointerException at org.infinispan.manager.impl.AbstractDelegatingEmbeddedCacheManager.getCacheManagerConfiguration(AbstractDelegatingEmbeddedCacheManager.java:91) at org.infinispan.manager.impl.AbstractDelegatingEmbeddedCacheManager.getCacheManagerConfiguration(AbstractDelegatingEmbeddedCacheManager.java:91) at org.infinispan.hibernate.cache.v53.InfinispanRegionFactory.defineDataTypeCacheConfigurations(InfinispanRegionFactory.java:393) at org.infinispan.hibernate.cache.v53.InfinispanRegionFactory.start(InfinispanRegionFactory.java:242) ... 66 more

        • 1. Re: Configuring infinispan with WildFly 13
          Paul Ferraro Master

          Wildfly 13 only uses Hibernate 5.3 when run with the system property ee8.preview.mode=true.

          Additionally, WF13 uses the same region factory implementation to support both the JPA and standalone hibernate use cases.  To use with standalone hibernate, you should additionally define the following property:

          <property name="hibernate.cache.infinispan.shared">false</property>