I'm using Hibernate 3.2.0.GA with JBoss Cache 1.3.0.SP2 in production. I know there is a known bug with this version of JBoss Cache on data replication (
http://jira.jboss.com/jira/browse/JBCACHE-843) but until this point I had not seen any adverse affects of the exception other than stale data in the target cache. This is shown in Stack Trace #2 below. Suddenly we are starting to get ArrayIndexOutOfBounds exceptions on one of the nodes when objects are loaded from the second level cache. This is shown in stack trace #1 below.
I can only assume this is due to a partially replicated object which Hibernate. Hiberante is assuming that the number of columns in the object will match with the number of expected Type objects.
Just wanted to report this to confirm that upgrading to JBoss Cache 1.4.1.SP3 will also resolve this issue and to see if the Hibernate code needs to be looked at.
Hibernate version:
3.2.0.GA
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Stack Trace #1
java.lang.ArrayIndexOutOfBoundsException
at org.hibernate.type.TypeFactory.assemble(TypeFactory.java:399)
at org.hibernate.cache.entry.CacheEntry.assemble(CacheEntry.java:96)
at org.hibernate.cache.entry.CacheEntry.assemble(CacheEntry.java:82)
at org.hibernate.event.def.DefaultLoadEventListener.assembleCacheEntry(DefaultLoadEventListener.java:540)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromSecondLevelCache(DefaultLoadEventListener.java:494)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:356)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:137)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:101)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:846)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266)
at org.hibernate.type.EntityType.resolve(EntityType.java:303)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2144)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
at org.hibernate.loader.Loader.list(Loader.java:2023)
at org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:888)
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)
Stack Trace #2
ERROR 46318151 [UpHandler (STATE_TRANSFER)] (org.jboss.cache.interceptors.OrderedSynchronizationHandler) 2007-05-31 13:00:03,996 - failed calling afterCompletion() on TxInterceptor.RemoteSynchronizationHandler(gtx=GlobalTransaction:<172.19.200.175:51240>:45172, tx=com.ibm.ws.Transaction.JTA.TransactionImpl@42bf42bf#tid=27159)
java.lang.RuntimeException: Commit failed, marking tx to be rolled back.
at org.jboss.cache.interceptors.TxInterceptor.runCommitPhase(TxInterceptor.java:700)
at org.jboss.cache.interceptors.TxInterceptor$RemoteSynchronizationHandler.afterCompletion(TxInterceptor.java:983)
at org.jboss.cache.interceptors.OrderedSynchronizationHandler.afterCompletion(OrderedSynchronizationHandler.java:80)
at com.ibm.ws.Transaction.JTA.RegisteredSyncs.distributeAfter(RegisteredSyncs.java:428)
at com.ibm.ws.Transaction.JTA.TransactionImpl.distributeAfter(TransactionImpl.java:3809)
at com.ibm.ws.Transaction.JTA.TransactionImpl.postCompletion(TransactionImpl.java:3788)
at com.ibm.ws.Transaction.JTA.TransactionImpl.prepareResources(TransactionImpl.java:2161)
at com.ibm.ws.Transaction.JTA.TransactionImpl.stage1CommitProcessing(TransactionImpl.java:1622)
at com.ibm.ws.Transaction.JTA.TransactionImpl.processCommit(TransactionImpl.java:1578)
at com.ibm.ws.Transaction.JTA.TransactionImpl.commit(TransactionImpl.java:1513)
at com.ibm.ws.Transaction.JTA.TranManagerImpl.commit(TranManagerImpl.java:237)
at com.ibm.ws.Transaction.JTA.TranManagerSet.commit(TranManagerSet.java:162)
at org.jboss.cache.interceptors.TxInterceptor.handleRemoteCommitRollback(TxInterceptor.java:570)
at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:126)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67)
at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:181)
at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:4804)
at org.jboss.cache.TreeCache._replicate(TreeCache.java:4366)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at org.jgroups.blocks.MethodCall.invoke(MethodCall.java:330)
at org.jgroups.blocks.RpcDispatcher.handle(RpcDispatcher.java:281)
at org.jgroups.blocks.RequestCorrelator.handleRequest(RequestCorrelator.java:650)
at org.jgroups.blocks.RequestCorrelator.receiveMessage(RequestCorrelator.java:535)
at org.jgroups.blocks.RequestCorrelator.receive(RequestCorrelator.java:358)
at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.up(MessageDispatcher.java:775)
at org.jgroups.JChannel.up(JChannel.java:1091)
at org.jgroups.stack.ProtocolStack.up(ProtocolStack.java:377)
at org.jgroups.stack.ProtocolStack.receiveUpEvent(ProtocolStack.java:393)
at org.jgroups.stack.Protocol.passUp(Protocol.java:538)
at org.jgroups.protocols.pbcast.STATE_TRANSFER.up(STATE_TRANSFER.java:158)
at org.jgroups.stack.UpHandler.run(Protocol.java:60)
Caused by:
java.lang.ClassCastException: org.hibernate.cache.OptimisticTreeCache$NonLockingDataVersion incompatible with org.jboss.cache.optimistic.DefaultDataVersion
at org.jboss.cache.interceptors.OptimisticValidatorInterceptor.commit(OptimisticValidatorInterceptor.java:212)
at org.jboss.cache.interceptors.OptimisticValidatorInterceptor.invoke(OptimisticValidatorInterceptor.java:68)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67)
at org.jboss.cache.interceptors.OptimisticLockingInterceptor.invoke(OptimisticLockingInterceptor.java:96)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67)
at org.jboss.cache.interceptors.OptimisticReplicationInterceptor.invoke(OptimisticReplicationInterceptor.java:102)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67)
at org.jboss.cache.interceptors.TxInterceptor.handleCommitRollback(TxInterceptor.java:643)
at org.jboss.cache.interceptors.TxInterceptor.runCommitPhase(TxInterceptor.java:687)
... 33 more
Name and version of the database you are using:
Oracle 9i