1 Reply Latest reply on May 3, 2013 6:26 AM by vishwa.h

    Stand-alone infinity server as remote caching server issue: org.hibernate.cache.NoCachingEnabledException: Second-level cache is not enabled for usage

    vishwa.h Newbie

      Hi,

       

      I need to modify the existing application to use remote infinity-span caching server. The existing project is configured with local EH cache provider for hibernate 3 implementation).

      I have done the following changes to the existing maven project, based on the inputs from discussion forum, related to remote cache configuration.

       

      1. Stand-alone infinispan server is running with following configuration ( ./startServer.sh -c remoteConfig.xml -r hotrod &)

       

      <infinispan>

      <namedCache name="test"/>

      </infinispan>

       

      2. hibernate persistent.xml

       

      <beans xmlns="http://www.springframework.org/schema/beans"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="http://www.springframework.org/schema/beans

      http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

       

          <!-- Hibernate session factory -->

          <bean id="sessionFactory"

              class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

       

              <property name="dataSource">

                  <ref bean="dataSource" />

              </property>

       

              <property name="hibernateProperties">

                  <props>

                      <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>

                       <prop key="hibernate.cache.use_second_level_cache">true</prop>

                      <prop key="hibernate.cache.use_query_cache">true</prop>

                      <prop key="hibernate.generate_statistics">true</prop>

                   </props>

              </property>

       

              <property name="mappingResources">

                  <list>

                      <value>hibernateMapping/Circuithierarchyspeccompatability.hbm.xml

                      </value>

                      <value>hibernateMapping/Codeconcrete.hbm.xml</value>

                     </list>

              </property>

       

          </bean>

      </beans>

       

      3. JBOSS7as config

       

       

      <?xml version='1.0' encoding='UTF-8'?>

       

      <server xmlns="urn:jboss:domain:1.2">

          <extensions>

              <extension module="org.jboss.as.clustering.infinispan"/>

          <extension module="org.jboss.as.clustering.jgroups"/>

          <extension module="org.jboss.as.configadmin"/>

              <extension module="org.jboss.as.connector"/>

              <extension module="org.jboss.as.deployment-scanner"/>

              <extension module="org.jboss.as.ee"/>

              <extension module="org.jboss.as.ejb3"/>

              <extension module="org.jboss.as.jaxrs"/>

              <extension module="org.jboss.as.jdr"/>

              <extension module="org.jboss.as.jmx"/>

              <extension module="org.jboss.as.jpa"/>

              <extension module="org.jboss.as.logging"/>

              <extension module="org.jboss.as.mail"/>

              <extension module="org.jboss.as.modcluster"/>

              <extension module="org.jboss.as.naming"/>

              <extension module="org.jboss.as.osgi"/>

              <extension module="org.jboss.as.pojo"/>

              <extension module="org.jboss.as.remoting"/>

              <extension module="org.jboss.as.sar"/>

              <extension module="org.jboss.as.security"/>

              <extension module="org.jboss.as.threads"/>

              <extension module="org.jboss.as.transactions"/>

              <extension module="org.jboss.as.web"/>

              <extension module="org.jboss.as.webservices"/>

              <extension module="org.jboss.as.weld"/>

          </extensions>

          ..............................

      .........................

          <profile>

              <subsystem xmlns="urn:jboss:domain:logging:1.1">

                  .............

             

              <subsystem xmlns="urn:jboss:domain:infinispan:1.2" default-cache-container="cluster">

                  <cache-container name="cluster" aliases="ha-partition" default-cache="test">

                      <transport lock-timeout="60000"/>

                      <distributed-cache name="test" mode="SYNC" owners="2" remote-timeout="30000" start="EAGER">

                  <remote-store socket-timeout="60000"

                      tcp-no-delay="true" fetch-state="false" preload="true" purge="false"

                      shared="true">

                  <remote-server outbound-socket-binding="remote-store-hotrod-server" />

                  </remote-store>

              </distributed-cache>

                  </cache-container>                   

              </subsystem>

             ...........

              <subsystem xmlns="urn:jboss:domain:jgroups:1.1" default-stack="udp">

                  <stack name="udp">

                      <transport type="UDP" socket-binding="jgroups-udp" diagnostics-socket-binding="jgroups-diagnostics"/>

                      <protocol type="PING"/>

                      <protocol type="MERGE2"/>

                      <protocol type="FD_SOCK" socket-binding="jgroups-udp-fd"/>

                      <protocol type="FD"/>

                      <protocol type="VERIFY_SUSPECT"/>

                      <protocol type="BARRIER"/>

                      <protocol type="pbcast.NAKACK"/>

                      <protocol type="UNICAST2"/>

                      <protocol type="pbcast.STABLE"/>

                      <protocol type="pbcast.GMS"/>

                      <protocol type="UFC"/>

                      <protocol type="MFC"/>

                      <protocol type="FRAG2"/>

                  </stack>

                  <stack name="tcp">

                      <transport type="TCP" socket-binding="jgroups-tcp" diagnostics-socket-binding="jgroups-diagnostics"/>

                      <protocol type="MPING" socket-binding="jgroups-mping"/>

                      <protocol type="MERGE2"/>

                      <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>

                      <protocol type="FD"/>

                      <protocol type="VERIFY_SUSPECT"/>

                      <protocol type="BARRIER"/>

                      <protocol type="pbcast.NAKACK"/>

                      <protocol type="UNICAST2"/>

                      <protocol type="pbcast.STABLE"/>

                      <protocol type="pbcast.GMS"/>

                      <protocol type="UFC"/>

                      <protocol type="MFC"/>

                      <protocol type="FRAG2"/>

                  </stack>

              </subsystem>

              ............

      ........

          <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">

             ..............

          <outbound-socket-binding name="remote-store-hotrod-server">

       

              <remote-destination host="127.0.0.1" port="11222"/>

       

          </outbound-socket-binding>

          </socket-binding-group>

      </server>

       

       

      When I try to start the server , I get folllowing error. Please advise me on the issue resolution.

       

      PS: HibernateSessionFactory.xml in the trace is persistent xml

       

      14:49:32,452 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-3) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/config/spring/HibernateSessionFactory.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Could not instantiate cache implementation

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455) [spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]