0 Replies Latest reply on Jul 20, 2009 3:14 AM by Borislav Bonev

    DataVersioningException in read only entities

    Borislav Bonev Newbie

      Hi, everyone

      I'm having problems with Jboss cache 3.0 and more specifically I'm having an exception:

      org.jboss.cache.optimistic.DataVersioningException: Version mismatch for node /persistence.unit:unitName=Project-ear.ear/Project-ejb.jar#project_unit/codelist/ENTITY: underlying node with version Ver=0 is newer than workspace node, with version org.hibernate.cache.jbc2.util.NonLockingDataVersion@60edcbaf


      I'll try to explain the application configuration:
      The 'codelist' from above is a cache region with 2 read only entities that are never modified in the application or from outside and the queries that retrieve them are cached too. This is working just fine as it is. The problem came when I added a native SQL query to update one field of one table. The table's entity is a parent for more than 70 other entities/tables. I chose native SQL query, because when I use hibernate to update the root table, it generates a query that joins all its descendants and it's ugly.
      One more thing, the native query is executed from a state full quartz job that uses a stateless EJB bean.

      I can't reproduce the problem. It just appears from time to time on our staging environment, for example i've never had the problem on my development Jboss server.
      My assumption is that the hibernate, the cache and the native query some how mixed up, but the query does not have anything in common with the cached entities.

      I'm using
      jboss-5.0.1.GA with jbpm-3.3.1.GA
      default POJO cache that ships with jboss with default configuration
      Quartz 1.6.5
      Informix 10.0 for DBMS

      I tried to isolate the cached entities as mush as possible. I also noticed the the exception is thrown while someone is doing
      something on the web interface of the application and I wonder if the problem is related with that. May be if the parent table is modified or the modification of the table causes the problem. And how the version 0 is newer, what is the previous version -1?

      Well I thing to stop with the question for now :)

      Thank you in advance. Any help will be appreciated.

      The complete exception is :
      10 Jun 2009 14:38:22,593 WARN [OptimisticTxInterceptor] Caught exception, will now set transaction to roll back
      org.jboss.cache.optimistic.DataVersioningException: Version mismatch for node /persistence.unit:unitName=Project-ear.ear/Project-ejb.jar#project_unit/codelist/ENTITY: underlying node with version Ver=0 is newer than workspace node, with version org.hibernate.cache.jbc2.util.NonLockingDataVersion@60edcbaf
       at org.jboss.cache.interceptors.OptimisticValidatorInterceptor.visitOptimisticPrepareCommand(OptimisticValidatorInterceptor.java:146)
       at org.jboss.cache.commands.tx.OptimisticPrepareCommand.acceptVisitor(OptimisticPrepareCommand.java:55)
       at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
       at org.jboss.cache.interceptors.OptimisticLockingInterceptor.visitOptimisticPrepareCommand(OptimisticLockingInterceptor.java:89)
       at org.jboss.cache.commands.tx.OptimisticPrepareCommand.acceptVisitor(OptimisticPrepareCommand.java:55)
       at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
       at org.jboss.cache.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:131)
       at org.jboss.cache.commands.AbstractVisitor.visitOptimisticPrepareCommand(AbstractVisitor.java:155)
       at org.jboss.cache.commands.tx.OptimisticPrepareCommand.acceptVisitor(OptimisticPrepareCommand.java:55)
       at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
       at org.jboss.cache.interceptors.TxInterceptor.runPreparePhase(TxInterceptor.java:638)
       at org.jboss.cache.interceptors.TxInterceptor$LocalSynchronizationHandler.beforeCompletion(TxInterceptor.java:1041)
       at org.jboss.cache.interceptors.OrderedSynchronizationHandler.beforeCompletion(OrderedSynchronizationHandler.java:81)
       at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:101)
       at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:263)
       at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
       at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
       at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1414)
       at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
       at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
       at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:170)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:201)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:219)
       at org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerBase.invoke(ProxyInvocationHandlerBase.java:261)
       at org.jboss.ejb3.proxy.handler.session.SessionSpecProxyInvocationHandlerBase.invoke(SessionSpecProxyInvocationHandlerBase.java:101)
       at $Proxy342.markMessageAsSent(Unknown Source)
       at com.company.client.project.quartz.jobs.CCNJob.execute(Unknown Source)
       at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
       at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
      10 Jun 2009 14:38:22,594 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_2] TwoPhaseCoordinator.beforeCompletion - failed for com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple@4718072d