karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Reilly <jdr0...@renci.org>
Subject hibernate caching
Date Wed, 03 May 2017 18:01:19 GMT
Hi all,

I tried to add caching to my persistence layer.  I added the following 
to my persistence.xml:


       <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.jcache.JCacheRegionFactory"
/>

       <property name="hibernate.javax.cache.provider" value="org.ehcache.jsr107.EhcacheCachingProvider"
/>

       <property name="hibernate.cache.use_second_level_cache" value="true" />

       <property name="hibernate.cache.use_query_cache" value="true" />


I added the necessary dependencies (test cases all run great), but this 
configuration doesn't seem to deploy nicely to Karaf (4.1.1).  The 
exception thrown is the following:


2017-05-03 13:03:30,645 | ERROR | atures.logging]) | configadmin                      | 5
- org.apache.felix.configadmin - 1.8.14 | [org.osgi.service.cm.ManagedService, id=242, bundle=75/mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/2.6.0]:
Unexpected problem updating configuration org.apache.aries.jpa.canvas

org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.cache.spi.RegionFactory]

     at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:271)
[249:org.hibernate.core:5.2.8.Final]

     at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:233)
[249:org.hibernate.core:5.2.8.Final]

     at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
[249:org.hibernate.core:5.2.8.Final]

     at org.hibernate.boot.internal.MetadataBuilderImpl$MetadataBuildingOptionsImpl.<init>(MetadataBuilderImpl.java:663)
[249:org.hibernate.core:5.2.8.Final]

     at org.hibernate.boot.internal.MetadataBuilderImpl.<init>(MetadataBuilderImpl.java:127)
[249:org.hibernate.core:5.2.8.Final]

     at org.hibernate.boot.MetadataSources.getMetadataBuilder(MetadataSources.java:135) [249:org.hibernate.core:5.2.8.Final]

     at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:214)
[249:org.hibernate.core:5.2.8.Final]

     at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:177)
[249:org.hibernate.core:5.2.8.Final]

     at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:83)
[249:org.hibernate.core:5.2.8.Final]

     at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:103)
[249:org.hibernate.core:5.2.8.Final]

     at org.hibernate.osgi.OsgiPersistenceProvider.createContainerEntityManagerFactory(OsgiPersistenceProvider.java:95)
[253:org.hibernate.osgi:5.2.8.Final]

     at org.apache.aries.jpa.container.impl.ManagedEMF.createAndPublishEMF(ManagedEMF.java:129)
[75:org.apache.aries.jpa.container:2.6.0]

     at org.apache.aries.jpa.container.impl.ManagedEMF.updated(ManagedEMF.java:125) [75:org.apache.aries.jpa.container:2.6.0]

     at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)
[5:org.apache.felix.configadmin:1.8.14]

     at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)
[5:org.apache.felix.configadmin:1.8.14]

     at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)
[5:org.apache.felix.configadmin:1.8.14]

     at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1463)
[5:org.apache.felix.configadmin:1.8.14]

     at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1419)
[5:org.apache.felix.configadmin:1.8.14]

     at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [5:org.apache.felix.configadmin:1.8.14]

     at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [5:org.apache.felix.configadmin:1.8.14]

     at java.lang.Thread.run(Thread.java:745) [?:?]

Caused by: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to
resolve name [org.hibernate.cache.jcache.JCacheRegionFactory] as strategy [org.hibernate.cache.spi.RegionFactory]

     at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:126)
~[?:?]

     at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveStrategy(StrategySelectorImpl.java:194)
~[?:?]

     at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveStrategy(StrategySelectorImpl.java:161)
~[?:?]

     at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:67)
~[?:?]

     at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:28)
~[?:?]

     at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
~[?:?]

     at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:259)
~[?:?]


Checking for exports:


karaf@root()> exports | grep org.hibernate.cache.spi

org.hibernate.cache.spi.access                                                           
             │ 5.2.8.Final   │ 249 │ org.hibernate.core

org.hibernate.cache.spi.entry                                                            
             │ 5.2.8.Final   │ 249 │ org.hibernate.core

org.hibernate.cache.spi                                                                  
             │ 5.2.8.Final   │ 249 │ org.hibernate.core

karaf@root()> exports | grep org.hibernate.cache.jcache

org.hibernate.cache.jcache.access                                                        
             │ 5.2.8.Final   │ 252 │ org.hibernate.jcache

org.hibernate.cache.jcache.time                                                          
             │ 5.2.8.Final   │ 252 │ org.hibernate.jcache

org.hibernate.cache.jcache                                                               
             │ 5.2.8.Final   │ 252 │ org.hibernate.jcache

karaf@root()> exports | grep org.ehcache.jsr107

org.ehcache.jsr107.config                                                                
             │ 0.0.0         │ 246 │ org.ehcache.ehcache

org.ehcache.jsr107                                                                       
             │ 0.0.0         │ 246 │ org.ehcache.ehcache


Anyone get Hibernate (5.2.8.Final) working in Karaf with caching?  
Suggestions?


Thanks,

Jason





Mime
View raw message