[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - ClassLoader isolation issue with ObjectMessage
jmesnil
do-not-reply at jboss.com
Tue Jan 8 12:24:31 EST 2008
in the trunk, ObjectMessageTest.testClassLoaderIsolation() is failing:
| junit.framework.AssertionFailedError: expected not same
| at org.jboss.test.messaging.util.ProxyAssertSupport.assertNotSame(ProxyAssertSupport.java:478)
| at org.jboss.test.messaging.jms.message.ObjectMessageTest.testClassLoaderIsolation(ObjectMessageTest.java:100)
|
The test sends an object message with the normal classloader and receives the message with another classloader set as the current thread's class loader.
It then checks that the two objects have different classes (since they should belong to 2 different classloaders)
I tried to reuse JBM Stable StreamUtils to unmarshall the object with the right context class loader but it did not work:
| Index: /home/jmesnil/workspace/jboss-messaging/src/main/org/jboss/jms/message/JBossObjectMessage.java
| ===================================================================
| --- /home/jmesnil/workspace/jboss-messaging/src/main/org/jboss/jms/message/JBossObjectMessage.java (revision 3545)
| +++ /home/jmesnil/workspace/jboss-messaging/src/main/org/jboss/jms/message/JBossObjectMessage.java (working copy)
| @@ -23,8 +23,6 @@
|
| import java.io.DataInputStream;
| import java.io.DataOutputStream;
| -import java.io.ObjectInputStream;
| -import java.io.ObjectOutputStream;
| import java.io.Serializable;
|
| import javax.jms.JMSException;
| @@ -124,9 +122,7 @@
|
| protected void writePayload(DataOutputStream daos) throws Exception
| {
| - ObjectOutputStream oos = new ObjectOutputStream(daos);
| - oos.writeObject(object);
| - oos.flush();
| + StreamUtils.writeObject(daos, object, false, true);
| }
|
| protected void readPayload(DataInputStream dais) throws Exception
| @@ -131,8 +127,7 @@
|
| protected void readPayload(DataInputStream dais) throws Exception
| {
| - ObjectInputStream ois = new ObjectInputStream(dais);
| - object = (Serializable)ois.readObject();
| + object = (Serializable)StreamUtils.readObject(dais, true);
| }
|
| // Private -------------------------------------------------------
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117998#4117998
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117998
More information about the jboss-dev-forums
mailing list