3 Replies Latest reply on Feb 17, 2009 6:13 AM by Mihai Ratiu

    OPTIMISTIC Node Locking Scheme Configuration for EJB3 Entity

    Mihai Ratiu Newbie

      Can someone tell me how to completely configure optimistic locking for EJB3EntityTreeCache? I put the

      <attribute name ="NodeLockingScheme">OPTIMISTIC</attribute>


      atribute in the ejb3-entity-cache-service.xml file, but I read on the wiki page that I need to setup an OptimisticTreeCacheProvider. How can I configure that? Also what other detail should I be aware of?

      Regards,
      Mihai

        • 1. Re: OPTIMISTIC Node Locking Scheme Configuration for EJB3 En
          Brian Stansberry Master

          In your persistence.xml use

          <property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.OptimisticTreeCacheProviderHook"/>


          instead of

          <property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.TreeCacheProviderHook"/>
          .

          This isn't strictly necessary though. OptimisticTreeCacheProviderHook is a trivial subclass of TreeCacheProviderHook. Both are able to detect the cache's NodeLockingScheme config and work appropriately. The only additional behavior in OptimisticTreeCacheProviderHook is it logs a WARN if the cache's NodeLockingScheme isn't OPTIMISTIC, since that suggests the user forgot to change the NodeLockingScheme.

          • 2. Re: OPTIMISTIC Node Locking Scheme Configuration for EJB3 En
            Mihai Ratiu Newbie

            Hi,

            I configured the cache with OPTIMISTIC Locking schema under 'all' configuration of a 4.0.5 GA instance. First I got the following error:

            INFO [OptimisticNodeInterceptor] Cannot Handle Method _put(GlobalTransaction:
            


            I understood that I'm using an older version(SP1 or what is the default version in a clean server configuration) of Jboss Cache 1.4.1 so I copied the new jars from Jboss Cache 1.4.1 SP10 to lib folder. The jars that I copied are jboss-cache.jar and jgroups.jar-> Are there any other jars from dist that I need to add in jboss lib folder to configure cache correctly?

            I also used OptimisticTreeCacheProviderHook as suggested.

            Now I get the following exception:

            
            javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoSuchMethodError: org.hibernate.cache.CacheException.<init>(Ljava/lang/Exception;)V
             at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
             at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
             at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
             at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:211)
             at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
             at $Proxy168.getSupportedSyncTypesAndCommands(Unknown Source)
             at com.snapon.nemo.server.ds.statemachine.eventproviders.Events.loadSupportedCommadsAndSyncTypes(Events.java:132)
             at com.snapon.nemo.server.ds.statemachine.eventproviders.Events.loadDataOnAplicationContext(Events.java:89)
             at com.snapon.nemo.server.ds.statemachine.service.SyncMLStartUpService.startService(SyncMLStartUpService.java:51)
             at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
             at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
             at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
             at $Proxy0.start(Unknown Source)
             at org.jboss.system.ServiceController.start(ServiceController.java:417)
             at org.jboss.system.ServiceController.start(ServiceController.java:435)
             at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
             at $Proxy29.start(Unknown Source)
             at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:449)
             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:597)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
             at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
             at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
             at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
             at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
             at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
             at $Proxy30.start(Unknown Source)
             at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
             at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
             at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
             at $Proxy82.deploy(Unknown Source)
             at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
             at org.jboss.ha.framework.server.FarmMemberService.deploy(FarmMemberService.java:412)
             at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
             at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
             at org.jboss.ha.framework.server.FarmMemberService.startService(FarmMemberService.java:212)
             at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
             at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
             at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
             at $Proxy0.start(Unknown Source)
             at org.jboss.system.ServiceController.start(ServiceController.java:417)
             at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
             at $Proxy4.start(Unknown Source)
             at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
             at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
             at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
             at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
             at $Proxy8.deploy(Unknown Source)
             at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
             at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
             at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
             at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
             at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
             at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
             at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
             at $Proxy0.start(Unknown Source)
             at org.jboss.system.ServiceController.start(ServiceController.java:417)
             at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
             at $Proxy4.start(Unknown Source)
             at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
             at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
             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:597)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
             at $Proxy5.deploy(Unknown Source)
             at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
             at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
             at org.jboss.Main.boot(Main.java:200)
             at org.jboss.Main$1.run(Main.java:490)
             at java.lang.Thread.run(Thread.java:619)
            Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodError: org.hibernate.cache.CacheException.<init>(Ljava/lang/Exception;)V
             at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:174)
             at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:46)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
             ... 177 more
            Caused by: java.lang.NoSuchMethodError: org.hibernate.cache.CacheException.<init>(Ljava/lang/Exception;)V
             at org.jboss.ejb3.entity.JBCCache.put(JBCCache.java:133)
             at org.hibernate.cache.TransactionalCache.put(TransactionalCache.java:58)
             at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:159)
             at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:854)
             at org.hibernate.loader.Loader.doQuery(Loader.java:729)
             at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
             at org.hibernate.loader.Loader.doList(Loader.java:2213)
             at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
             at org.hibernate.loader.Loader.list(Loader.java:2099)
             at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
             at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
             at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
             at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
             at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
             at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:65)
             at com.snapon.nemo.server.ds.datastore.DataStore.getSupportedSyncTypesAndCommands(DataStore.java:80)
             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:597)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
             at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
             ... 184 more
            


            From what I understand the root cause is the cache put

            org.jboss.ejb3.entity.JBCCache.put(JBCCache.java:133)


            The NoSuchMethodError seems to be from an older version of Hibernate that jboss 4.0.5 is using by default, but my concern is why the cache doesn't support put operations?

            Is this because of hibernate or something?

            Regards,
            Mihai

            • 3. Re: OPTIMISTIC Node Locking Scheme Configuration for EJB3 En
              Mihai Ratiu Newbie

              Also here is my current cache configuration.

              <?xml version="1.0" encoding="UTF-8"?>
              
              <server>
              
              
              
               <!-- ==================================================================== -->
              
               <!-- Defines TreeCache configuration -->
              
               <!-- ==================================================================== -->
              
               <mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=EJB3EntityTreeCache">
              
               <depends>jboss:service=Naming</depends>
              
               <depends>jboss:service=TransactionManager</depends>
              
              
              
               <!-- uncomment next three statements if using JGroups multiplexer,
              
               requires JGroups 2.3 or later, JBossCache 1.4 or later -->
              
               <!--
              
               <depends>jgroups.mux:name=Multiplexer</depends>
              
               <attribute name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
              
               <attribute name="MultiplexerStack">fc-fast-minimalthreads</attribute>
              
               -->
              
              
              
               <!-- Configure the TransactionManager -->
              
               <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
              
              
              
               <!--
              
               Node locking level : SERIALIZABLE
              
               REPEATABLE_READ (default)
              
               READ_COMMITTED
              
               READ_UNCOMMITTED
              
               NONE
              
               -->
              
               <attribute name ="NodeLockingScheme">OPTIMISTIC</attribute>
              
               <!--attribute name="IsolationLevel">REPEATABLE_READ</attribute-->
              
              
              
               <!-- Valid modes are LOCAL
              
               REPL_ASYNC
              
               REPL_SYNC
              
               -->
              
               <attribute name="CacheMode">LOCAL</attribute>
              
              
              
               <!-- Name of cluster. Needs to be the same for all clusters, in order
              
               to find each other -->
              
               <attribute name="ClusterName">EJB3-entity-cache</attribute>
              
              
              
               <!-- Must be true if any entity deployment uses a scoped classloader -->
              
               <attribute name="UseRegionBasedMarshalling">false</attribute>
              
               <!-- Must match the value of "UseRegionBasedMarshalling" -->
              
               <attribute name="InactiveOnStartup">false</attribute>
              
              
              
               <attribute name="ClusterConfig">
              
               <config>
              
               <!-- UDP: if you have a multihomed machine,
              
               set the bind_addr attribute to the appropriate NIC IP address
              
               -->
              
               <!-- UDP: On Windows machines, because of the media sense feature
              
               being broken with multicast (even after disabling media sense)
              
               set the loopback attribute to true
              
               -->
              
               <UDP mcast_addr="${jboss.partition.udpGroup:228.1.2.3}" mcast_port="43333" ip_ttl="${jgroups.mcast.ip_ttl:2}" ip_mcast="true"
              
               mcast_send_buf_size="150000" mcast_recv_buf_size="80000" ucast_send_buf_size="150000"
              
               ucast_recv_buf_size="80000" loopback="false" />
              
               <PING timeout="2000" num_initial_members="3" up_thread="false" down_thread="false" />
              
               <MERGE2 min_interval="10000" max_interval="20000" />
              
               <FD_SOCK down_thread="false" up_thread="false"/>
              
               <FD shun="true" up_thread="false" down_thread="false"
              
               timeout="20000" max_tries="5"/>
              
               <VERIFY_SUSPECT timeout="1500" up_thread="false" down_thread="false" />
              
               <pbcast.NAKACK gc_lag="50" max_xmit_size="8192" retransmit_timeout="600,1200,2400,4800" up_thread="false"
              
               down_thread="false" />
              
               <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10" down_thread="false" />
              
               <pbcast.STABLE desired_avg_gossip="20000" up_thread="false" down_thread="false" />
              
               <FRAG frag_size="8192" down_thread="false" up_thread="false" />
              
               <pbcast.GMS join_timeout="5000" join_retry_timeout="2000" shun="true" print_local_addr="true" />
              
               <pbcast.STATE_TRANSFER up_thread="false" down_thread="false" />
              
               </config>
              
               </attribute>
              
              
              
               <!-- The max amount of time (in milliseconds) we wait until the
              
               initial state (ie. the contents of the cache) are retrieved from
              
               existing members in a clustered environment
              
               -->
              
               <attribute name="InitialStateRetrievalTimeout">5000</attribute>
              
              
              
               <!-- Number of milliseconds to wait until all responses for a
              
               synchronous call have been received.
              
               -->
              
               <attribute name="SyncReplTimeout">10000</attribute>
              
              
              
               <!-- Max number of milliseconds to wait for a lock acquisition -->
              
               <attribute name="LockAcquisitionTimeout">15000</attribute>
              
              
              
               <!-- Name of the eviction policy class. -->
              
               <attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
              
              
              
               <!-- Specific eviction policy configurations. This is LRU -->
              
               <attribute name="EvictionPolicyConfig">
              
               <config>
              
               <attribute name="wakeUpIntervalSeconds">5</attribute>
              
              
               <region name="/_default_">
              
               <attribute name="maxNodes">5000</attribute>
              
               <attribute name="timeToLiveSeconds">0</attribute>
              
               </region>
              
              
               <region name="/com/snapon/nemo/security/usersmanagement/datastore/persistence/ChromeUsersEntity">
              
               <attribute name="maxNodes">5000</attribute>
              
               <attribute name="timeToLiveSeconds">0</attribute>
              
               </region>
              
               <region name="/com/snapon/nemo/security/usersmanagement/datastore/persistence/GroupsEntity">
              
               <attribute name="maxNodes">5000</attribute>
              
               <attribute name="timeToLiveSeconds">0</attribute>
              
               </region>
              
               <region name="/com/snapon/nemo/security/usersmanagement/datastore/persistence/UserTypeEntity">
              
               <attribute name="maxNodes">5000</attribute>
              
               <attribute name="timeToLiveSeconds">0</attribute>
              
               </region>
              
               <region name="/com/snapon/nemo/server/connectors/syncml/datastore/persistence/DataStoresConnEntity">
              
               <attribute name="maxNodes">5000</attribute>
              
               <attribute name="timeToLiveSeconds">0</attribute>
              
               </region>
              
               <region name="/com/snapon/nemo/server/connectors/syncml/datastore/persistence/PendingDataStoresConnEntity">
              
               <attribute name="maxNodes">5000</attribute>
              
               <attribute name="timeToLiveSeconds">0</attribute>
              
               </region>
              
               <region name="/com/snapon/nemo/server/ds/datastore/persistence/DataStoresEntity">
               <attribute name="maxNodes">5000</attribute>
              
               <attribute name="timeToLiveSeconds">0</attribute>
              
               </region>
              
               <region name="/com/snapon/nemo/server/ds/datastore/persistence/PendingDataStoresEntity">
               <attribute name="maxNodes">5000</attribute>
              
               <attribute name="timeToLiveSeconds">0</attribute>
              
               </region>
              
              
               </config>
              
               </attribute>
              
              
              
               </mbean>
              
              
              
              </server>
              


              I want to use optmistic locking because when running concurrent sessions on server, with Pessimistic locking and isolation level set to REPEATABLE_READ, I get acquire lock exceptions that look like this:

              ERROR [ReadWriteLockWithUpgrade] upgradeLockAttempt(): more than one reader trying to simultaneously upgrade to write lock
              16:49:26,041 ERROR [STDERR] javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoSuchMethodError: org.hibernate.cache.CacheException.<init>(Ljava/lang/Exception;)V
              16:49:26,041 ERROR [STDERR] at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
              16:49:26,041 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
              16:49:26,041 ERROR [STDERR] at org.jboss.aspects.tx.TxIntercep
              


              I also must suggest that my entities are read-only and "pseudo" or almost read only, because there is a few data that needs to be written but a lot of data must be read from here.

              If you have any other suggestion to configure properly my cache please let me know.


              Regards,
              Mihai