-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: ClassLoader issue w/JB4.2, Could not sync db state session
PostPosted: Wed Jul 25, 2007 6:55 pm 
Newbie

Joined: Wed Jul 25, 2007 6:33 pm
Posts: 9
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);
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 26, 2007 4:56 am 
Senior
Senior

Joined: Tue Jul 25, 2006 9:05 am
Posts: 163
Location: Stuttgart/Karlsruhe, Germany
Hi,

are you missing an @Id in your StoredMessage entity ??

Cheers,

Andy

_________________
Rules are only there to be broken


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 26, 2007 4:38 pm 
Newbie

Joined: Wed Jul 25, 2007 6:33 pm
Posts: 9
It's there, I admittedly omitted some code.

I'm guessing either the JBoss JMS inflow adapter, the transaction manager, or Hibernate aren't setting the right classloader during the commit.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.