[jboss-user] [JBoss Cache: Core Edition] - TimeoutException in a READ_ONLY Cache Entity

fabianignacio do-not-reply at jboss.com
Thu Oct 2 16:03:30 EDT 2008


Hi

I'm facing a problem using TreeCacheProviderHook.
I have this Entity Bean:


  | @Entity
  | @Table(name = "MERCHANTCATEGORY")
  | @Cache(usage=CacheConcurrencyStrategy.READ_ONLY)
  | public class MerchantCategory implements Serializable {
  |     
  |     @Id
  |     @Column(name = "ID_MERCHANTCATEGORY", nullable = false)
  |     private Long idMerchantCategory;
  | 
  |     @Column(name = "CATEGORYNAME")
  |     private String category;
  | 
  |     @Column(name = "DESCRIPTION")
  |     private String description;
  | }
  | 


With this persistence.xml


  | <?xml version="1.0" encoding="UTF-8"?>
  | <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  |     <persistence-unit name="PPSPU" transaction-type="JTA">
  |         <jta-data-source>java:/OracleDS</jta-data-source>
  |         <properties>
  |         	<property name="hibernate.show_sql" value="true"/>
  |                 <property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.TreeCacheProviderHook"/>
  |                 <property name="hibernate.treecache.mbean.object_name" value="jboss.cache:service=EJB3EntityTreeCache"/>        	
  |         </properties>
  |     </persistence-unit>
  | </persistence>
  | 

In a JBoss 4.2.0GA.
I'm recieving this Exception, what I belive it shoudn't be like that, cause it's a READ_ONLY Cache:


  | 2008-10-01 22:00:38,609 INFO  [org.hibernate.event.def.DefaultLoadEventListener] Error performing load command
  | org.hibernate.cache.CacheException: org.jboss.cache.lock.TimeoutException: failure acquiring lock: fqn=/pps_ear,pps-ejb_jar,PPSPU/pps/ejb/db/MerchantCategory, caller=Thread[Timer-9,5,jboss], lock=write owner=GlobalTransaction:<192.168.1.100:4880>:65 (activeReaders=0, activeWriter=Thread[Timer-9,5,jboss], waitingReaders=0, waitingWriters=0, waitingUpgrader=0)
  | 	at org.jboss.ejb3.entity.JBCCache.read(JBCCache.java:111)
  | 	at org.jboss.ejb3.entity.JBCCache.get(JBCCache.java:99)
  | 	at org.hibernate.cache.ReadOnlyCache.put(ReadOnlyCache.java:54)
  | 	at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:156)
  | 	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.loadEntity(Loader.java:1860)
  | 	at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
  | 	at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
  | 	at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3042)
  | 	at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
  | 	at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
  | 	at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
  | 	at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)
  | 	at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
  | 	at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
  | 	at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
  | 	at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
  | 	at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:174)
  | 	at org.jboss.ejb3.entity.TransactionScopedEntityManager.find(TransactionScopedEntityManager.java:171)
  | 	at pps.ejb.core.transfer.POSSettlementBean.batchSettlement(POSSettlementBean.java:186)
  | 	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)
  | 	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:47)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
  | 	at org.jboss.aspects.tx.TxInterceptor$RequiresNew.invoke(TxInterceptor.java:262)
  | 	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.remoting.ReplicantsManagerInterceptor.invoke(ReplicantsManagerInterceptor.java:51)
  | 	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:106)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
  | 	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.dynamicInvoke(StatelessContainer.java:278)
  | 	at org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:79)
  | 	at org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor.invoke(ClusteredIsLocalInterceptor.java:53)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessClusteredProxy.invoke(StatelessClusteredProxy.java:105)
  | 	at $Proxy260.batchSettlement(Unknown Source)
  | 	at pps.app.scheduler.POSBatchSettlement.perform(POSBatchSettlement.java:47)
  | 	at org.jboss.varia.scheduler.Scheduler$Listener.handleNotification(Scheduler.java:1251)
  | 	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:597)
  | 	at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
  | 	at $Proxy11.handleNotification(Unknown Source)
  | 	at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:257)
  | 	at javax.management.NotificationBroadcasterSupport$SendNotifJob.run(NotificationBroadcasterSupport.java:322)
  | 	at javax.management.NotificationBroadcasterSupport$1.execute(NotificationBroadcasterSupport.java:307)
  | 	at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:229)
  | 	at javax.management.timer.Timer.sendNotification(Timer.java:1234)
  | 	at javax.management.timer.Timer.notifyAlarmClock(Timer.java:1203)
  | 	at javax.management.timer.TimerAlarmClock.run(Timer.java:1286)
  | 	at java.util.TimerThread.mainLoop(Timer.java:512)
  | 	at java.util.TimerThread.run(Timer.java:462)
  | Caused by: org.jboss.cache.lock.TimeoutException: failure acquiring lock: fqn=/pps_ear,pps-ejb_jar,PPSPU/pps/ejb/db/MerchantCategory, caller=Thread[Timer-9,5,jboss], lock=write owner=GlobalTransaction:<192.168.1.100:4880>:65 (activeReaders=0, activeWriter=Thread[Timer-9,5,jboss], waitingReaders=0, waitingWriters=0, waitingUpgrader=0)
  | 	at org.jboss.cache.Node.acquire(Node.java:500)
  | 	at org.jboss.cache.interceptors.PessimisticLockInterceptor.acquireNodeLock(PessimisticLockInterceptor.java:379)
  | 	at org.jboss.cache.interceptors.PessimisticLockInterceptor.lock(PessimisticLockInterceptor.java:307)
  | 	at org.jboss.cache.interceptors.PessimisticLockInterceptor.invoke(PessimisticLockInterceptor.java:181)
  | 	at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
  | 	at org.jboss.cache.interceptors.UnlockInterceptor.invoke(UnlockInterceptor.java:32)
  | 	at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
  | 	at org.jboss.cache.interceptors.ReplicationInterceptor.invoke(ReplicationInterceptor.java:39)
  | 	at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
  | 	at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:365)
  | 	at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:160)
  | 	at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
  | 	at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:138)
  | 	at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:5863)
  | 	at org.jboss.cache.TreeCache.get(TreeCache.java:3627)
  | 	at org.jboss.cache.TreeCache.get(TreeCache.java:3608)
  | 	at org.jboss.ejb3.entity.JBCCache.read(JBCCache.java:108)
  | 	... 71 more
  | Caused by: org.jboss.cache.lock.TimeoutException: read lock for /pps_ear,pps-ejb_jar,PPSPU/pps/ejb/db/MerchantCategory could not be acquired by Thread[Timer-9,5,jboss] after 15000 ms. Locks: Read lock owners: []
  | Write lock owner: GlobalTransaction:<192.168.1.100:4880>:65
  | , lock info: write owner=GlobalTransaction:<192.168.1.100:4880>:65 (activeReaders=0, activeWriter=Thread[Timer-9,5,jboss], waitingReaders=0, waitingWriters=0, waitingUpgrader=0)
  | 	at org.jboss.cache.lock.IdentityLock.acquireReadLock(IdentityLock.java:262)
  | 	at org.jboss.cache.Node.acquireReadLock(Node.java:512)
  | 	at org.jboss.cache.Node.acquire(Node.java:474)
  | 	... 87 more
  | 

At POSSettlementBean.java:186 I'm just calling a em.find() for another Entity (Merchant) that has MerchantCategory as a property 


  | merchant = em.find(pps.ejb.db.Merchant.class, idMerchant.longValue());
  | 

Do anyone know why JBoss Cache is locking a READ_ONLY Cache Entity?
Regards

Fabian 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4180150#4180150

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4180150



More information about the jboss-user mailing list