karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Reilly <jdr0...@renci.org>
Subject Re: hibernate caching
Date Wed, 03 May 2017 19:32:30 GMT
Quick update....

Adding the following to my dao-api/pom.xml file:

<Import-Package>org.hibernate.proxy,org.ehcache.jsr107,org.hibernate.cache.jcache,javassist.util.proxy,*</Import-Package>


I get the following at startup:


2017-05-03 15:21:08,067 | ERROR | pache.cxf.osgi]) | configadmin                      | 5
- org.apache.felix.configadmin - 1.8.14 | [org.osgi.service.cm.ManagedService, id=236, bundle=73/mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/2.6.1]:
Unexpected problem updating configuration org.apache.aries.jpa.canvas

javax.persistence.PersistenceException: [PersistenceUnit: canvas] Unable to build Hibernate
SessionFactory

     at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:967)
[246:org.hibernate.core:5.2.10.Final]

     at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:892)
[246:org.hibernate.core:5.2.10.Final]

     at org.hibernate.osgi.OsgiPersistenceProvider.createContainerEntityManagerFactory(OsgiPersistenceProvider.java:96)
[251:org.hibernate.osgi:5.2.10.Final]

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

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

     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.service.spi.ServiceException: Unable to create requested service
[org.hibernate.engine.spi.CacheImplementor]

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

     at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:233)
~[?:?]

     at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
~[?:?]

     at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.getService(SessionFactoryServiceRegistryImpl.java:77)
~[?:?]

     at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:240)
~[?:?]

     at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:452)
~[?:?]

     at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:889)
~[?:?]

     ... 11 more

Caused by: javax.cache.CacheException: Failed to load the CachingProvider [org.ehcache.jsr107.EhcacheCachingProvider]

     at javax.cache.Caching$CachingProviderRegistry.loadCachingProvider(Caching.java:169)
~[?:?]

     at javax.cache.Caching$CachingProviderRegistry.getCachingProvider(Caching.java:184) ~[?:?]

     at javax.cache.Caching$CachingProviderRegistry.getCachingProvider(Caching.java:156) ~[?:?]

     at javax.cache.Caching.getCachingProvider(Caching.java:66) ~[?:?]

     at org.hibernate.cache.jcache.JCacheRegionFactory.getCachingProvider(JCacheRegionFactory.java:157)
~[?:?]

     at org.hibernate.cache.jcache.JCacheRegionFactory.getCacheManager(JCacheRegionFactory.java:166)
~[?:?]

     at org.hibernate.cache.jcache.JCacheRegionFactory.start(JCacheRegionFactory.java:68)
~[?:?]

     at org.hibernate.cache.spi.RegionFactory.start(RegionFactory.java:63) ~[?:?]

     at org.hibernate.internal.CacheImpl.<init>(CacheImpl.java:71) ~[?:?]

     at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:28) ~[?:?]

     at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:20) ~[?:?]

     at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:58)
~[?:?]

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

     at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:233)
~[?:?]

     at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
~[?:?]

     at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.getService(SessionFactoryServiceRegistryImpl.java:77)
~[?:?]

     at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:240)
~[?:?]

     at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:452)
~[?:?]

     at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:889)
~[?:?]

     ... 11 more

Caused by: java.lang.ClassNotFoundException: org.ehcache.jsr107.EhcacheCachingProvider

     at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:?]

     at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:?]

     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[?:?]

     at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]

     at javax.cache.Caching$CachingProviderRegistry.loadCachingProvider(Caching.java:162)
~[?:?]

     at javax.cache.Caching$CachingProviderRegistry.getCachingProvider(Caching.java:184) ~[?:?]

     at javax.cache.Caching$CachingProviderRegistry.getCachingProvider(Caching.java:156) ~[?:?]

     at javax.cache.Caching.getCachingProvider(Caching.java:66) ~[?:?]



On 05/03/2017 02:01 PM, Jason Reilly wrote:
> 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