JMSException in onMessage(): javax.jms.JMSException
siva156 Jun 5, 2012 9:08 AMhi
im trying to send object through jms queue..
<code>
public void onMessage(Message queuemessage) {
try {
if (queuemessage instanceof ObjectMessage) {
ObjectMessage Objmsg = (ObjectMessage) queuemessage;
System.out.println(((ObjectMessage)queuemessage).getJMSDestination());
System.out.println(((ObjectMessage)queuemessage).getJMSMessageID());
Object objectData = ((ObjectMessage)queuemessage).getObject(); // i'm getting exception in this line
if (objectData instanceof TestClass) {
TestClass s1 = (TestClass) objectData;
System.out.println("Reading message s1: " +s1.getEid());
}
</code>
TestClass implements java.io.Serializable. im using jboss-6.0.0.final
im not getting this exception when i sent String object.
im getting JMSDestination ,JMSMessageID from the queuemessage. It throws exception in getObject() method.
How to get my testclass object in onmessage method??? What is wrong in the code?
I have attached my code.
Please suggest.
Exception:
17:35:02,611 INFO [STDOUT] HornetQQueue[Myqueue1]
17:35:09,197 INFO [STDOUT] ID:a242b9ff-aede-11e1-9332-00016c4d854e
17:39:58,209 ERROR [STDERR] javax.jms.JMSException: com.test.TestClass
17:39:58,209 ERROR [STDERR] at java.net.URLClassLoader$1.run(Unknown Source)
17:39:58,209 ERROR [STDERR] at java.net.URLClassLoader$1.run(Unknown Source)
17:39:58,209 ERROR [STDERR] at java.security.AccessController.doPrivileged(Native Method)
17:39:58,209 ERROR [STDERR] at java.net.URLClassLoader.findClass(Unknown Source)
17:39:58,209 ERROR [STDERR] at java.lang.ClassLoader.loadClass(Unknown Source)
17:39:58,209 ERROR [STDERR] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
17:39:58,209 ERROR [STDERR] at java.lang.ClassLoader.loadClass(Unknown Source)
17:39:58,209 ERROR [STDERR] at java.lang.Class.forName0(Native Method)
17:39:58,209 ERROR [STDERR] at java.lang.Class.forName(Unknown Source)
17:39:58,209 ERROR [STDERR] at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:284)
17:39:58,209 ERROR [STDERR] at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1152)
17:39:58,210 ERROR [STDERR] at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:886)
17:39:58,210 ERROR [STDERR] at org.jboss.classloader.spi.base.BaseClassLoader.doLoadClass(BaseClassLoader.java:505)
17:39:58,219 ERROR [STDERR] at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:450)
17:39:58,219 ERROR [STDERR] at java.lang.ClassLoader.loadClass(Unknown Source)
17:39:58,219 ERROR [STDERR] at java.lang.Class.forName0(Native Method)
17:39:58,219 ERROR [STDERR] at java.lang.Class.forName(Unknown Source)
17:39:58,219 ERROR [STDERR] at java.io.ObjectInputStream.resolveClass(Unknown Source)
17:39:58,219 ERROR [STDERR] at org.hornetq.utils.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:69)
17:39:58,219 ERROR [STDERR] at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
17:39:58,220 ERROR [STDERR] at java.io.ObjectInputStream.readClassDesc(Unknown Source)
17:39:58,220 ERROR [STDERR] at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
17:39:58,220 ERROR [STDERR] at java.io.ObjectInputStream.readObject0(Unknown Source)
17:39:58,220 ERROR [STDERR] at java.io.ObjectInputStream.readObject(Unknown Source)
17:39:58,220 ERROR [STDERR] at org.hornetq.jms.client.HornetQObjectMessage.getObject(HornetQObjectMessage.java:158)
17:39:58,220 ERROR [STDERR] at com.test.Sender.onMessage(Sender.java:91)
17:39:58,220 ERROR [STDERR] at org.hornetq.jms.client.JMSMessageListenerWrapper.onMessage(JMSMessageListenerWrapper.java:91)
17:39:58,221 ERROR [STDERR] at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:822)
17:39:58,221 ERROR [STDERR] at org.hornetq.core.client.impl.ClientConsumerImpl.access$100(ClientConsumerImpl.java:46)
17:39:58,221 ERROR [STDERR] at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:940)
17:39:58,221 ERROR [STDERR] at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)
17:39:58,221 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
17:39:58,221 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
17:39:58,221 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)
-
TestClass.java.zip 336 bytes
-
Sender.java.zip 1.2 KB