Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-3080

Infinispan second level cache is not working with Hibernate 3.6.x

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 7.1.0.CR1
    • Fix Version/s: None
    • Component/s: JPA / Hibernate
    • Labels:
      None
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Add this line in persistence.xml:

      <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.infinispan.JndiInfinispanRegionFactory"/>

      And add this bean to your deployed:

      @javax.ejb.Stateless
      public class JndiResourceHack

      { @javax.annotation.Resource(mappedName = "java:jboss/infinispan/hibernate") private Object object; }
      Show
      Add this line in persistence.xml: <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.infinispan.JndiInfinispanRegionFactory"/> And add this bean to your deployed: @javax.ejb.Stateless public class JndiResourceHack { @javax.annotation.Resource(mappedName = "java:jboss/infinispan/hibernate") private Object object; }

      Description

      CacheManager is not available in JNDI at JPA subsystem startup. Seems likely to be related to AS7-1656.

      Relevant section of startup logs:

      10:56:41,036 INFO [org.hibernate.transaction.TransactionFactoryFactory] (MSC service thread 1-1) Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
      10:56:41,036 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] (MSC service thread 1-1) instantiating TransactionManagerLookup: org.jboss.as.jpa.hibernate3.JBossAppServerJtaPlatform
      10:56:41,036 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] (MSC service thread 1-1) instantiated TransactionManagerLookup
      10:56:41,036 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Automatic flush during beforeCompletion(): disabled
      10:56:41,036 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Automatic session close at end of transaction: disabled
      10:56:41,036 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) JDBC batch size: 15
      10:56:41,036 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) JDBC batch updates for versioned data: disabled
      10:56:41,036 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Scrollable result sets: enabled
      10:56:41,036 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) JDBC3 getGeneratedKeys(): enabled
      10:56:41,036 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Connection release mode: auto
      10:56:41,036 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Maximum outer join fetch depth: 3
      10:56:41,036 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Default batch fetch size: 8
      10:56:41,037 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Generate SQL with comments: disabled
      10:56:41,037 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Order SQL updates by primary key: disabled
      10:56:41,037 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Order SQL inserts for batching: disabled
      10:56:41,037 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
      10:56:41,037 INFO [org.hibernate.hql.ast.ASTQueryTranslatorFactory] (MSC service thread 1-1) Using ASTQueryTranslatorFactory
      10:56:41,037 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Query language substitutions: {}
      10:56:41,037 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) JPA-QL strict compliance: enabled
      10:56:41,037 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Second-level cache: enabled
      10:56:41,037 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Query cache: enabled
      10:56:41,037 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Cache region factory : org.hibernate.cache.infinispan.JndiInfinispanRegionFactory
      10:56:41,037 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Optimize cache for minimal puts: enabled
      10:56:41,037 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Cache region prefix: pluto-resources.ear#PlutoMainPU
      10:56:41,037 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Structured second-level cache entries: enabled
      10:56:41,037 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Query cache factory: org.hibernate.cache.StandardQueryCacheFactory
      10:56:41,037 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Statistics: disabled
      10:56:41,038 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Deleted entity synthetic identifier rollback: disabled
      10:56:41,038 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Default entity-mode: pojo
      10:56:41,038 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Named query checking : enabled
      10:56:41,038 INFO [org.hibernate.cfg.SettingsFactory] (MSC service thread 1-1) Check Nullability in Core (should be disabled when Bean Validation is on): disabled
      10:56:41,285 INFO [org.hibernate.impl.SessionFactoryImpl] (MSC service thread 1-1) building session factory
      10:56:41,285 INFO [org.hibernate.type.BasicTypeRegistry] (MSC service thread 1-1) Type registration [materialized_blob] overrides previous : org.hibernate.type.MaterializedBlobType@4863d8a7
      10:56:41,286 INFO [org.hibernate.cache.infinispan.JndiInfinispanRegionFactory] (MSC service thread 1-1) Unable to retrieve CacheManager from JNDI [java:jboss/infinispan/hibernate]: javax.naming.NameNotFoundException: Error looking up infinispan/hibernate, service service jboss.naming.context.java.jboss.infinispan.hibernate is not started
      at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:121) [jboss-as-naming-7.1.0.CR1-SNAPSHOT.jar:]
      at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:74) [jboss-as-naming-7.1.0.CR1-SNAPSHOT.jar:]
      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:177) [jboss-as-naming-7.1.0.CR1-SNAPSHOT.jar:]
      at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:97) [jboss-as-naming-7.1.0.CR1-SNAPSHOT.jar:]
      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:213) [jboss-as-naming-7.1.0.CR1-SNAPSHOT.jar:]
      at javax.naming.InitialContext.lookup(InitialContext.java:392) [:1.6.0_26]
      at org.hibernate.cache.infinispan.JndiInfinispanRegionFactory.locateCacheManager(JndiInfinispanRegionFactory.java:75) [hibernate-infinispan-3.6.7.Final.jar:]
      at org.hibernate.cache.infinispan.JndiInfinispanRegionFactory.createCacheManager(JndiInfinispanRegionFactory.java:68) [hibernate-infinispan-3.6.7.Final.jar:]
      at org.hibernate.cache.infinispan.InfinispanRegionFactory.start(InfinispanRegionFactory.java:256) [hibernate-infinispan-3.6.7.Final.jar:]
      at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:238) [hibernate-core-3.6.7.Final.jar:]
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872) [hibernate-core-3.6.7.Final.jar:]
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:906) [hibernate-entitymanager-3.6.7.Final.jar:]
      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) [hibernate-entitymanager-3.6.7.Final.jar:]
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:149) [jboss-as-jpa-7.1.0.CR1-SNAPSHOT.jar:]
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:79) [jboss-as-jpa-7.1.0.CR1-SNAPSHOT.jar:]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]
      at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]

      10:56:41,287 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.persistenceunit."pluto-resources.ear#PlutoMainPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."pluto-resources.ear#PlutoMainPU": Failed to start service
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780) [jboss-msc-1.0.1.GA.jar:]
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]
      at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: PlutoMainPU] Unable to build EntityManagerFactory
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)
      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:149)
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:79)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:]
      ... 3 more
      Caused by: org.hibernate.cache.CacheException: Unable to retrieve CacheManager from JNDI [java:jboss/infinispan/hibernate]
      at org.hibernate.cache.infinispan.JndiInfinispanRegionFactory.locateCacheManager(JndiInfinispanRegionFactory.java:79)
      at org.hibernate.cache.infinispan.JndiInfinispanRegionFactory.createCacheManager(JndiInfinispanRegionFactory.java:68)
      at org.hibernate.cache.infinispan.InfinispanRegionFactory.start(InfinispanRegionFactory.java:256)
      at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:238)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:906)
      ... 8 more

      10:56:41,507 INFO [org.jboss.as.deployment] (DeploymentScanner-threads - 1) Deployment of "pluto-resources.ear" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"pluto-resources.ear#PlutoIdentityPU\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"pluto-resources.ear#PlutoIdentityPU\": Failed to start service","jboss.persistenceunit.\"pluto-resources.ear#PlutoMainPU\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"pluto-resources.ear#PlutoMainPU\": Failed to start service"}}
      10:56:41,738 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) Stopped deployment pluto-interop.jar in 237ms
      10:56:41,739 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) Stopped deployment pluto-framework.jar in 239ms
      10:56:41,741 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) Stopped deployment pluto-rest.war in 241ms
      10:56:41,773 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) Stopped deployment pluto-resources.ear in 273ms
      10:56:41,775 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report
      JBAS014777: Services which failed to start: service jboss.persistenceunit."pluto-resources.ear#PlutoIdentityPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."pluto-resources.ear#PlutoIdentityPU": Failed to start service
      service jboss.persistenceunit."pluto-resources.ear#PlutoMainPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."pluto-resources.ear#PlutoMainPU": Failed to start service

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                brentdouglas Brent Douglas
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: