9 Replies Latest reply on Nov 18, 2008 3:20 PM by Brian Stansberry

    is compatible jboss cache 3.0 with hibernate 3.3?

    Ramazan Pekin Newbie

      Hi,
      I cant find information about hibernate and jboss cache 3.0 CR2 compatibility. I want to use jboss cache as secondary level caching, but I cant guaranteed they are compatible.

        • 1. Re: is compatible jboss cache 3.0 with hibernate 3.3?
          Manik Surtani Master

          Why don't you try it out. :-) I'd recommend the latest CR.

          • 2. Re: is compatible jboss cache 3.0 with hibernate 3.3?
            Ramazan Pekin Newbie

            We have decided to use JBoss Cache and JBoss POJO Cache...

            • 3. Re: is compatible jboss cache 3.0 with hibernate 3.3?
              Ramazan Pekin Newbie

              is MVCC method enabled other versions(2.x.x)? Is it only capable with 3?

              • 5. Re: is compatible jboss cache 3.0 with hibernate 3.3?
                Radovan Sninsky Newbie

                Hi all,

                I tried Hibernate 3.3.1 and jboss cache 3.0 CR3 and I've got this result. Google didn't help.

                12.11.2008 13:25:26 org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge <init>
                INFO: Cache provider: org.hibernate.cache.TreeCacheProvider
                org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge]
                 at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:412)
                 at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:271)
                 at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
                 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
                 at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
                 at sk.bgs.hbm.Test1.setUp(Test1.java:29)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:585)
                 at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
                 at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:416)
                 at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:154)
                 at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:88)
                 at org.testng.TestRunner.beforeRun(TestRunner.java:508)
                 at org.testng.TestRunner.run(TestRunner.java:476)
                 at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
                 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
                 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
                 at org.testng.SuiteRunner.run(SuiteRunner.java:204)
                 at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:864)
                 at org.testng.TestNG.runSuitesLocally(TestNG.java:830)
                 at org.testng.TestNG.run(TestNG.java:748)
                 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
                 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:585)
                 at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
                Caused by: java.lang.reflect.InvocationTargetException
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
                 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
                 at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
                 at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:407)
                 ... 29 more
                Caused by: java.lang.NoClassDefFoundError: org/jboss/cache/TransactionManagerLookup
                 at java.lang.Class.getDeclaredConstructors0(Native Method)
                 at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
                 at java.lang.Class.getConstructor0(Class.java:2671)
                 at java.lang.Class.newInstance0(Class.java:321)
                 at java.lang.Class.newInstance(Class.java:303)
                 at org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge.<init>(RegionFactoryCacheProviderBridge.java:63)
                 ... 34 more
                


                Could someone help?

                hibernate.cfg.xml fragment:
                 <property name="hibernate.cache.use_second_level_cache">true</property>
                 <property name="hibernate.cache.provider_class">org.hibernate.cache.TreeCacheProvider</property>
                


                Thanks,
                Radovan

                • 6. Re: is compatible jboss cache 3.0 with hibernate 3.3?
                  Ramazan Pekin Newbie

                  I was trying, and I have taken error, and I decided to write, I have seen sninsky have been writed already, these are my logs:


                  Nov 12, 2008 4:25:43 PM org.apache.catalina.core.StandardContext listenerStart
                  SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
                  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build EntityManagerFactory
                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
                   at java.security.AccessController.doPrivileged(Native Method)
                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
                   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
                   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
                   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
                   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
                   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
                   at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
                   at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:597)
                   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366)
                   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
                   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
                   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
                   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
                   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
                   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
                   at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
                   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
                   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
                   at org.apache.catalina.core.StandardService.start(StandardService.java:516)
                   at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
                   at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                   at java.lang.reflect.Method.invoke(Unknown Source)
                   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
                   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
                  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build EntityManagerFactory
                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
                   at java.security.AccessController.doPrivileged(Native Method)
                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
                   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
                   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
                   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
                   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
                   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
                   at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:308)
                   at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:270)
                   at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:122)
                   at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:78)
                   at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:70)
                   at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:97)
                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1325)
                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
                   ... 29 more
                  Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build EntityManagerFactory
                   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
                   at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
                   at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:224)
                   at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:291)
                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
                   ... 46 more
                  Caused by: org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge]
                   at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:412)
                   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:271)
                   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
                   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
                   at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
                   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
                   ... 51 more
                  Caused by: java.lang.reflect.InvocationTargetException
                   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                   at java.lang.reflect.Constructor.newInstance(Unknown Source)
                   at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:407)
                   ... 56 more
                  Caused by: java.lang.NoClassDefFoundError: org/jboss/cache/TransactionManagerLookup
                   at java.lang.Class.getDeclaredConstructors0(Native Method)
                   at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
                   at java.lang.Class.getConstructor0(Unknown Source)
                   at java.lang.Class.newInstance0(Unknown Source)
                   at java.lang.Class.newInstance(Unknown Source)
                   at org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge.<init>(RegionFactoryCacheProviderBridge.java:63)
                   ... 61 more
                  


                  • 7. Re: is compatible jboss cache 3.0 with hibernate 3.3?
                    Ramazan Pekin Newbie

                    Hi,
                    Is there any solution for this error at jboss cache side? or, Does Hibernate has to modify it self? If you can give any idea, I will wait or I will use a stabil version.
                    Thanks for your helps.

                    • 8. Re: is compatible jboss cache 3.0 with hibernate 3.3?
                      Manik Surtani Master

                      And you can confirm that this works with JBC 2.2.0?

                      • 9. Re: is compatible jboss cache 3.0 with hibernate 3.3?
                        Brian Stansberry Master

                        You're using Hibernate's legacy "CacheProvider" caching integration rather than the new "RegionFactory" one that came out with Hibernate 3.3.

                        JBC 2 and JBC 3 are only supported via the "RegionFactory".

                        Docs for how to use this can be found at http://galder.zamarreno.com/wp-content/uploads/2008/09/hibernate-jbosscache-guide.pdf

                        Apologies that this remains such a secret so long after 3.3 came out. I don't understand why the above guide isn't included on Hibernate's docs page after several requests to get it added. It's actually part of the Hibernate documentation build.