6 Replies Latest reply on Mar 29, 2018 11:57 AM by alessandromoscatelli

    Custom Hibernate slot and second level cache with Wildfly 12

    alessandromoscatelli

      I am migrating to Wildfly 12 (JavaEE8 Hurray!).

      Everything is OK but I can't enable the second level cache with a custom Hibernate slot (maybe Wildfly 12 is not compatible with the recent Wildfly 11 Hibernate orm releases ?) :

      Maven Repository: org.hibernate » hibernate-orm-modules

       

      I am specifying the slot version in the persistance.xml as the guide says :

       

      <property name="jboss.as.jpa.providerModule" value="org.hibernate:5.2.13.Final" />

       

      If I do so, a Nullpointer exception occurs on deploy.

       

      I fail to understand how to configure the slot version in the new hibernate cache configuration in standalone.xml, since the cache module changed from org.hibernate.infinispan to org.infinispan.hibernate-cache

       

                  <cache-container name="hibernate" default-cache="local-query" module="org.infinispan.hibernate-cache">
                      <transport lock-timeout="60000"/>
                      <local-cache name="local-query">
                          <object-memory size="10000"/>
                          <expiration max-idle="100000"/>
                      </local-cache>
                      <invalidation-cache name="entity">
                          <transaction mode="NON_XA"/>
                          <object-memory size="10000"/>
                          <expiration max-idle="100000"/>
                      </invalidation-cache>
                      <replicated-cache name="timestamps"/>
                  </cache-container>
      

       

      This was my Wildfly 11 Hibernate configuration in standalone.xml

       

                  <cache-container name="hibernate" default-cache="local-query" module="org.hibernate.infinispan:5.2.13.Final">
                      <transport lock-timeout="60000"/>
                      <local-cache name="local-query">
                          <eviction strategy="LRU" max-entries="10000"/>
                          <expiration max-idle="100000"/>
                      </local-cache>
                      <invalidation-cache name="entity">
                          <transaction mode="NON_XA"/>
                          <eviction strategy="LRU" max-entries="10000"/>
                          <expiration max-idle="100000"/>
                      </invalidation-cache>
                      <replicated-cache name="timestamps" mode="ASYNC"/>
                  </cache-container>
      

       

      Thank you for you answers.

        • 1. Re: Custom Hibernate slot and second level cache with Wildfly 12
          jaikiran

          Please post the complete exception stacktrace.

          • 2. Re: Custom Hibernate slot and second level cache with Wildfly 12
            alessandromoscatelli
            16:12:28,868 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) WFLYJPA0002: Read persistence.xml for optoplus
            16:12:29,142 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."optoplus-services-ear-1.0.18-SNAPSHOT.ear".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."optoplus-services-ear-1.0.18-SNAPSHOT.ear".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment "optoplus-services-ear-1.0.18-SNAPSHOT.ear"
             at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:151)
             at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1714)
             at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1693)
             at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1540)
             at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
             at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
             at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
             at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
             at java.lang.Thread.run(Thread.java:748)
            Caused by: java.lang.NullPointerException
             at org.jboss.as.jpa.processor.secondLevelCache.InfinispanCacheDeploymentListener.addCacheDependencies(InfinispanCacheDeploymentListener.java:129)
             at org.jboss.as.jpa.processor.secondLevelCache.CacheDeploymentListener.addCacheDependencies(CacheDeploymentListener.java:111)
             at org.jipijapa.event.impl.internal.Notification.addCacheDependencies(Notification.java:95)
             at org.jboss.as.jpa.hibernate5.HibernateSecondLevelCache.addSecondLevelCacheDependencies(HibernateSecondLevelCache.java:125)
             at org.jboss.as.jpa.hibernate5.HibernatePersistenceProviderAdaptor.addProviderDependencies(HibernatePersistenceProviderAdaptor.java:107)
             at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deployPersistenceUnitPhaseOne(PersistenceUnitServiceHandler.java:538)
             at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.addPuService(PersistenceUnitServiceHandler.java:273)
             at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.handleEarDeployment(PersistenceUnitServiceHandler.java:228)
             at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:135)
             at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:52)
             at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:144)
             ... 8 more
            16:12:29,155 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"optoplus-services-ear-1.0.18-SNAPSHOT.ear\".FIRST_MODULE_USE" => "WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment \"optoplus-services-ear-1.0.18-SNAPSHOT.ear\"
                Caused by: java.lang.NullPointerException"}}
            
            • 3. Re: Custom Hibernate slot and second level cache with Wildfly 12
              jaikiran

              Can you please file a JIRA for this here - JBoss Issue Tracker  and point to this thread for reference?

              • 5. Re: Custom Hibernate slot and second level cache with Wildfly 12
                jaikiran

                alessandromoscatelli  wrote:

                 

                So I guess it's not my fault ?

                 

                I don't have much knowledge in that area, but the fact that it's throwing a NullPointerException is definitely a bug. If there's some genuine error with what you are attempting, a better exception is expected to be thrown.

                • 6. Re: Custom Hibernate slot and second level cache with Wildfly 12
                  alessandromoscatelli

                  I spent the whole day trying every possible combination and nothing works.

                  Documentation is outdated so :

                  could you please prove a tested combination and configuration of wildfly 12 + custom hibernate orm modules ?

                  At the top I can read "Wildfly 11"
                  https://mvnrepository.com/artifact/org.hibernate/hibernate-orm-modules

                  Is this even supposed to work with Wildfly 12 ? Is this too soon ?