4 Replies Latest reply on Jul 26, 2012 9:23 AM by thospfuller

    Problem with Infinispan 5.1.5 with Hibernate version 3.6.10.

    thospfuller

      Hi Folks,

       

      This conversation pertains to a problem I have found in the Grails Infinispan plugin today -- let me explain:

       

      I am using Infinispan 5.1.5 on Grails 2.1.0, which ships with Hibernate 3.6.10.

       

      The problem, I believe, is that the exception below indicates that somewhere along the line an attempt is being made to load org/hibernate/cache/spi/RegionFactory, which is included in Hibernate 4.0.0, whereas Grails 2.1.0 ships with Hibernate version 3.6.10 which includes the class org.hibernate.cache.RegionFactory.

       

      Is there a way to configure Infinispan such that it can work with an older version of Hibernate?

       

      [update] This appears to be related to https://issues.jboss.org/browse/AS7-3080.

       

      Thanks for your help,

       

      Tom

       

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/cache/spi/RegionFactory

           at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

           at java.util.concurrent.FutureTask.run(FutureTask.java:138)

           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

           at java.lang.Thread.run(Thread.java:662)

       

      The user configures Infinispan as a second level cache using the following:

       

      hibernate {

          cache.use_second_level_cache = true

          cache.use_query_cache = true

          cache.region.factory_class = 'org.hibernate.cache.infinispan.InfinispanRegionFactory'

      }

        • 1. Re: Problem with Infinispan 5.1.5 with Hibernate version 3.6.10.
          galder.zamarreno

          Your issue seems to be related to an API change in Hibernate itself, nothing to do with the the Infinispan implementation itself. Infinispan just implemented what Hibernate instructed it to. In 3.6.x, it was cache/RegionFactory and in 4.x onwards, cache/spi/RegionFactory.

           

          Btw, this is not related with https://issues.jboss.org/browse/AS7-3080

          • 2. Re: Problem with Infinispan 5.1.5 with Hibernate version 3.6.10.
            thospfuller

            Hi Galder,

             

            Sorry I don't think there's anything wrong with the Infinispan impl itself -- perhaps this would be better suited in the Hibernate discussion but since there appears to be a problem with the InfinispanRegionFactory, I thought I'd start here -- let me know if this needs to be taken up with the Hibernate forum.

             

            Re: "Btw, this is not related with https://issues.jboss.org/browse/AS7-3080"

             

            Can you support this with evidence?

             

            My evidence: AS7-3080 is entitled "Infinispan second level cache is not working with Hibernate 3.6.x" and they are talking about Infinispan version 5.

             

            The last comment by Scott Marlow:

             

            "Hibernate 3.x doesn't have Infinispan 5.x integration code (this is only in Hibernate 4.x)."

             

            So either there's a way of setting the 2nd level cache on Hibernate v 3.6.10 such that it works with Infinispan 5.1.5, or perhaps there needs to be a custom InfinispanRegionFactory written to allow the two to play together nicely (which I may do myself if nobody else has done this already).

             

            Do you have a suggestion?

             

            Thanks for your help,

             

            Tom

            • 3. Re: Problem with Infinispan 5.1.5 with Hibernate version 3.6.10.
              galder.zamarreno

              Indeed, looks to me it's more of a discussion that you should be posted in the Hibernate forums.

               

              Sure, I can even give you forensic evidence if you need to...

               

              What I was trying to say is that Hibernate API changes have nothing to do with AS7-3080. Hibernate API changes are a Hibernate issue.

               

              That doesn't mean that what Scott says in AS7-3080 is wrong, Infinispan 5.x has not been tested with Hibernate 3.x, and the integration code to bind the two together in Hibernate 3.x codebase is designed for Infinispan 4.x. Besides, the integration code in Hibernate 4.x that can deal with Infinispan 5.x is incompatible with Hibernate 3.x. So, some surgery would need doing if you want to get Hibernate 3.x with Infinispan 5.x. Might even easier for you to upgradde to Hibernate 4.x directly.

              1 of 1 people found this helpful
              • 4. Re: Problem with Infinispan 5.1.5 with Hibernate version 3.6.10.
                thospfuller

                Hi Galder,

                 

                OK that explains a lot. Thanks for your help.

                 

                Tom