2 Replies Latest reply on Sep 5, 2014 10:23 AM by rmgiorgi

    Infinispan Level 2 caching with Hibernate therows exception Unexpected element '{urn:infinispan:config:4.0}infinispan'

    IND RC Newbie

      Hi

      I am trying to configure level 2 caching with infinispan6, hibernate3.6 and spring3.2, however it fails with below stack:

      Can someone help me debug this issue? Will really appreciate if someone can share some details.

       

      org.hibernate.cache.CacheException: Unable to start region factory

        org.hibernate.cache.infinispan.InfinispanRegionFactory.start(InfinispanRegionFactory.java:270)

        org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:238)

        org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)

        org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:863)

        org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:782)

        org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:188)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)

        org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)

        org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)

        org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)

        org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)

        org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912)

        org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855)

        org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)

        org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486)

        org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)

        org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)

        org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)

        org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)

        org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)

        org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)

        org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912)

        org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855)

        org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)

        org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486)

        org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)

        org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)

        org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)

        org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)

        org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)

        org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)

        org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)

        org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)

        org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)

        org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

        org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)

        com.citrix.server.Server2.<clinit>(Server2.java:19)

        sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

        sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

        java.lang.reflect.Constructor.newInstance(Unknown Source)

        org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1092)

        org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:261)

        org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:336)

        org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:454)

        org.glassfish.jersey.process.internal.RequestScope.findOrCreate(RequestScope.java:158)

        org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2296)

        org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:590)

        org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:577)

        org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:172)

        org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:185)

        org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:103)

        org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:128)

        org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:131)

        org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:131)

        org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:131)

        org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:131)

        org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:110)

        org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:65)

        org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)

        org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:246)

        org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)

        org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)

        org.glassfish.jersey.internal.Errors.process(Errors.java:315)

        org.glassfish.jersey.internal.Errors.process(Errors.java:297)

        org.glassfish.jersey.internal.Errors.process(Errors.java:267)

        org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:318)

        org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:235)

        org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:983)

        org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:359)

        org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:372)

        org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:335)

        org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:218)

       

       

      root cause

       

       

      org.infinispan.commons.CacheConfigurationException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[2,101]

      Message: Unexpected element '{urn:infinispan:config:4.0}infinispan'

        org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:102)

        org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:253)

        org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:226)

        org.hibernate.cache.infinispan.InfinispanRegionFactory.createCacheManager(InfinispanRegionFactory.java:299)

        org.hibernate.cache.infinispan.InfinispanRegionFactory.start(InfinispanRegionFactory.java:256)

        org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:238)

        org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)

        org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:863)

        org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:782)

        org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:188)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)

        org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)

        org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)

        org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)

        org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)

        org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912)

        org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855)

        org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)

        org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486)

        org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)

        org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)

        org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)

        org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)

        org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)

        org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)

        org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912)

        org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855)

        org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)

        org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486)

        org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)

        org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)

        org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)

        org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)

        org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)

        org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)

        org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)

        org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)

        org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)

        org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

        org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)

        com.citrix.server.Server2.<clinit>(Server2.java:19)

        sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

        sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

        java.lang.reflect.Constructor.newInstance(Unknown Source)

        org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1092)

        org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:261)

        org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:336)

        org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:454)

        org.glassfish.jersey.process.internal.RequestScope.findOrCreate(RequestScope.java:158)

        org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2296)

        org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:590)

        org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:577)

        org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:172)

        org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:185)

        org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:103)

        org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:128)

        org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:131)

        org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:131)

        org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:131)

        org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:131)

        org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:110)

        org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:65)

        org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)

        org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:246)

        org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)

        org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)

        org.glassfish.jersey.internal.Errors.process(Errors.java:315)

        org.glassfish.jersey.internal.Errors.process(Errors.java:297)

        org.glassfish.jersey.internal.Errors.process(Errors.java:267)

        org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:318)

        org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:235)

        org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:983)

        org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:359)

        org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:372)

        org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:335)

        org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:218)

       

       

      My spring bean xml looks like this -

       

      <property name="hibernateProperties">
           <props>
           <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
             <prop key="hibernate.show_sql">true</prop>
             <prop key="hibernate.cache.use_second_level_cache">true</prop>
             <prop key="hibernate.cache.use_query_cache">true</prop>
             <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.infinispan.InfinispanRegionFactory</prop>
           </props>
           </property>