1 Reply Latest reply on Jul 25, 2007 6:26 PM by Elias Ross

    Could not synchronize database state with session

    Elias Ross Master

      JBoss 4.2.0

      Appears to be a classloader issue, and maybe more a question for Hibernate people. But it happens during commit. The class in question is located and scoped in a .ear file.

      I'm using an MDB that's operating on some EJB3 entities and doing a store. Haven't had this problem before in other scenarios, I'm not sure why Hibernate can't find the class. Could it be because the Arjuna isn't setting the right classloader?

      2007-07-25 11:31:34,056 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
      org.hibernate.type.SerializationException: could not deserialize
       at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:214)
       at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:240)
       at org.hibernate.type.SerializableType.fromBytes(SerializableType.java:82)
       at org.hibernate.type.SerializableType.deepCopyNotNull(SerializableType.java:74)
       at org.hibernate.type.MutableType.deepCopy(MutableType.java:25)
       at org.hibernate.type.SerializableToBlobType.deepCopy(SerializableToBlobType.java:102)
       at org.hibernate.type.TypeFactory.deepCopy(TypeFactory.java:353)
       at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:114)
       at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
       at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
       at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:515)
       at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:114)
       at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:249)
       at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:88)
       at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
       at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1256)
       at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
       at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
       at org.jboss.resource.adapter.jms.inflow.JmsServerSession$XATransactionDemarcationStrategy.end(JmsServerSession.java:494)
       at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:248)
       at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
       at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
       at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: com.example.msg.Message
       at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:306)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:514)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:408)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:242)
       at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:574)
       at org.hibernate.util.SerializationHelper$CustomObjectInputStream.resolveClass(SerializationHelper.java:268)
       at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)
       at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
       at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:210)
       ... 28 more
      


      followed by:

      2007-07-25 11:31:34,058 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_2] TwoPhaseCoordinator.beforeCompletion - failed for com.arjuna.ats.inte
      rnal.jta.resources.arjunacore.SynchronizationImple@169e486
      javax.persistence.PersistenceException: org.hibernate.type.SerializationException: could not deserialize
       at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
       at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:524)
       at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:114)
       at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:249)
       at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:88)
       at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
       at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1256)
       at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
       at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
       at org.jboss.resource.adapter.jms.inflow.JmsServerSession$XATransactionDemarcationStrategy.end(JmsServerSession.java:494)
       at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:248)
       at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
       at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
       at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: org.hibernate.type.SerializationException: could not deserialize
       at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:214)
       at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:240)
       at org.hibernate.type.SerializableType.fromBytes(SerializableType.java:82)
       at org.hibernate.type.SerializableType.deepCopyNotNull(SerializableType.java:74)
       at org.hibernate.type.MutableType.deepCopy(MutableType.java:25)
       at org.hibernate.type.SerializableToBlobType.deepCopy(SerializableToBlobType.java:102)
       at org.hibernate.type.TypeFactory.deepCopy(TypeFactory.java:353)
       at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:114)
       at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
       at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
       at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:515)
       ... 13 more
      Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: com.example.msg.Message
       at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:306)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:514)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:408)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:242)
       at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:574)
       at org.hibernate.util.SerializationHelper$CustomObjectInputStream.resolveClass(SerializationHelper.java:268)
       at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)
       at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
       at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:210)
       ... 28 more
      


      The transaction gets processed about 10 times, then the MDB gives up.

      I checked the release notes for 4.2.1, didn't see any JIRA issue addressing this one.