-
15. Re: JMS Consumer (servlet) can not resolve class of the object passed in ObjectMessage
shoemael Feb 11, 2011 10:39 AM (in response to hamfors)I just encountered this same issue in jboss-6.0.0.Final. Maybe a regression? The ClassLoader switching suggested by jaikiran worked around it but the same application code was previously working on jboss 5.1 without it.
-
16. JMS Consumer (servlet) can not resolve class of the object passed in ObjectMessage
jaikiran Feb 22, 2011 9:59 AM (in response to shoemael)shoemael wrote:
I just encountered this same issue in jboss-6.0.0.Final. Maybe a regression? The ClassLoader switching suggested by jaikiran worked around it but the same application code was previously working on jboss 5.1 without it.
For JBoss AS6, HornetQ is the messaging implementation. So please follow the other discussion here http://community.jboss.org/message/586079#586079
-
17. JMS Consumer (servlet) can not resolve class of the object passed in ObjectMessage
shoemael Feb 22, 2011 4:11 PM (in response to jaikiran)Thanks. I've added that thread to my watch list. Interestingly, I was using HornetQ as the JMS provider in 5.1 without this problem.
-
18. Re: JMS Consumer (servlet) can not resolve class of the object passed in ObjectMessage
amit.dey7 Feb 24, 2015 1:05 AM (in response to jaikiran)Hello ,
I have similar issue.
I tried both the approach but still I am getting same error.
My Code:
@SuppressWarnings("unchecked")
@Override
public void onMessage(Message message) {
if (message instanceof ObjectMessage) {
ObjectMessage om = (ObjectMessage) message;
ClassLoader originalTCCL = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
Object obj = om.getObject();
if (obj instanceof HashSet<?>) {
Thread.currentThread().setContextClassLoader(EventStatusCache.class.getClassLoader());
HashSet<CacheNotificationMessage> msgs=(HashSet<CacheNotificationMessage>)obj;
for (Object object:msgs){
CacheNotificationMessage msg = DrEventCache.unmarshalMesssage(object);
updateCache(msg);
}
return;
}
} catch (JMSException e) {
}finally{
Thread.currentThread().setContextClassLoader(originalTCCL);
}
final CacheNotificationMessage msg = getNotification(message);
if(msg!=null){
Thread.currentThread().setContextClassLoader(EventStatusCache.class.getClassLoader());
updateCache(msg);
}
}
}
And ERROR :
:10:30,920 ERROR [ClientConsumer] RuntimeException was thrown from onMessage, 23343150137655305 will be redelivered
va.lang.RuntimeException: com.akuacom.utils.drw.CacheNotificationMessage
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:292)
at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1119)
at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:798)
at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:441)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:602)
at org.jboss.messaging.util.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:78)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1589)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1494)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1748)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1327)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:349)
at org.jboss.messaging.util.StreamUtils.readObject(StreamUtils.java:154)
at org.jboss.messaging.core.impl.message.MessageSupport.readPayload(MessageSupport.java:392)
at org.jboss.jms.message.JBossObjectMessage.getObject(JBossObjectMessage.java:126)
at org.jboss.jms.message.ObjectMessageProxy.getObject(ObjectMessageProxy.java:68)
at com.akuacom.pss2.drw.cache.DrEventCache.onMessage(DrEventCache.java:112)
at org.jboss.jms.client.container.ClientConsumer.callOnMessage(ClientConsumer.java:229)
at org.jboss.jms.client.container.ClientConsumer$ListenerRunner.run(ClientConsumer.java:1043)
at org.jboss.messaging.util.OrderedExecutorFactory$ChildExecutor.run(OrderedExecutorFactory.java:120)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Can you please throw some light ?
Any help will be highly appreciated.
Thanks