0 Replies Latest reply on Jun 20, 2008 2:30 PM by John Deviney

    Class Loader Issue using ObjectMessage

    John Deviney Newbie

      I've read through several posts that describe the problem I am running into. One of those posts indicates this problem was fixed but I still have the same problem.

      Environment:

      Jboss 4.2.2 GA
      Jboss Messaging 1.4.0 SP3
      Java 1.5.0_06

      Problem:

      I have two JMS clients, a MDB running inside Jboss AS and a stand-alone Java client. Both clients receive an ObjectMessage. The MDB implementation works as expected. The Java client fails on ObjectMessage.getObject() with the following stack trace:

      org.jboss.messaging.util.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:65)\r\n\tat java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)\r\n\tat java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)\r\n\tat java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)\r\n\tat java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)\r\n\tat java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)\r\n\tat org.jboss.messaging.util.StreamUtils.readObject(StreamUtils.java:154)\r\n\tat org.jboss.messaging.core.impl.message.MessageSupport.getPayload(MessageSupport.java:246)\r\n\tat org.jboss.jms.message.JBossObjectMessage.getObject(JBossObjectMessage.java:125)\r\n\tat org.jboss.jms.message.ObjectMessageProxy.getObject(ObjectMessageProxy.java:64)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\r\n\tat java.lang.reflect.Method.invoke(Method.java:585)\r\n\tat com.jnbridge.jnbcore.JNBDispatcher.objectVirtualCall(Unknown Source)\r\n\tat com.jnbridge.jnbcore.JNBDispatcher.call(Unknown Source)\r\n\tat com.jnbridge.jnbcore.server.sharedmem.SharedMemRequestHandler.a(Unknown Source)\r\n\tat com.jnbridge.jnbcore.server.sharedmem.SharedMemRequestHandler.handleRequest(Unknown Source)\r\n" string

      If I change my stand-alone Java client to receive a TextMessage it works fine.

      I read through the following posts:

      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=101710

      http://jira.jboss.org/jira/browse/JBMESSAGING-924

      http://jboss.com/index.html?module=bb&op=viewtopic&p=4028694

      It would seem this issue was resolved in Jboss Messaging 1.2.0 SP1. So why am I having the same problem?

      If I insert the following code inside onMessage() it works but according to the posts above I shouldn't have to do this:

      java.lang.Class c=java.lang.Class.forName("org.twia.jms.SimpleObjectMessage");
       java.lang.Thread.currentThread().setContextClassLoader(c.getClassLoader());


      Regards.