Hibernate version:
"3.2.3.ga" bundled with JBoss 4.2
Full stack trace of any exception that occurs:
2007-07-25 11:14:41,313 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
Name and version of the database you are using:
HSQLDB
Debug level Hibernate log excerpt:
2007-07-25 12:31:56,896 TRACE [AbstractFlushingEventListener] executing flush
2007-07-25 12:31:56,896 TRACE [ConnectionManager] registering flush begin
2007-07-25 12:31:56,896 TRACE [AbstractEntityPersister] Updating entity: [com.playphone.msg.StorableMessage#1]
2007-07-25 12:31:56,896 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 59)
2007-07-25 12:31:56,896 DEBUG [ConnectionManager] opening JDBC connection
2007-07-25 12:31:56,896 DEBUG [SQL] update MESSAGE_STORE set MESSAGE=?, CREATED=? where MESSAGE_ID=?
2007-07-25 12:31:56,896 TRACE [AbstractBatcher] preparing statement
2007-07-25 12:31:56,896 TRACE [AbstractEntityPersister] Dehydrating entity: [com.example.msg.StorableMessage#1]
2007-07-25 12:31:56,896 TRACE [SerializationHelper] Starting serialization of object [Msg[ id=0 dest=4052456257 sc=10952 state=null content=Content[ type=TEXT content=Premiu
m message] ]]
2007-07-25 12:31:56,896 TRACE [SerializationHelper] Starting serialization of object [Msg[ id=0 dest=4052456257 sc=10952 state=null content=Content[ type=TEXT content=Premiu
m message] ]]
2007-07-25 12:31:56,896 TRACE [SerializationHelper] Starting deserialization of object
2007-07-25 12:31:56,897 TRACE [SerializationHelper] Attempting to locate class [com.example.msg.Message]
2007-07-25 12:31:56,897 TRACE [SerializationHelper] Asking super to resolve
...
2007-07-25 12:31:56,898 TRACE [SerializationHelper] Attempting to locate class [java.util.Date]
2007-07-25 12:31:56,898 TRACE [SerializationHelper] Class resolved through context class loader
...
2007-07-25 12:31:56,899 TRACE [SerializationHelper] Asking super to resolve
2007-07-25 12:31:56,899 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
I could try putting a test case together, it would probably need the following ingredients:
* JBoss 4.2.0, with JBoss Messaging 1.2 (not sure this is the problem or not)
* MDB using EJB3 EntityManager
The code would:
* Load a serializable object, whose class is scoped in a .ear, during onMessage() using EntityManger
* Modify one of the fields
* The EM does a commit() during container commit.
Code:
@Entity
@Table(name="MESSAGE_STORE")
public class StorableMessage implements Serializable {
private static final long serialVersionUID = -3970782197071154952L;
private int messageId = 0;
private Message message;
@Column(name = "MESSAGE")
@Lob
public Serializable getStoredMessage() {
return message;
}
public void setStoredMessage(Serializable message) {
this.message = (Message)message;
}
}
public class Message implements Serializable, Cloneable {
int i;
public void setSomeValue(int i) {
this.i = i;
}
}
...
MDB {
public void onMessage() {
StorableMessage sm = em.find(...);
Message m = (Message)sm.getStoredMessage();
m.setSomeValue(2);
}
}