[jboss-user] [Installation, Configuration & DEPLOYMENT] - Re: JBoss 5.1.0.CR1 classloader isolation issue

zradick do-not-reply at jboss.com
Fri May 8 16:27:31 EDT 2009


I don't actually get a stacktrace because I test the Object before attempting to cast it:

  |    public void onMessage ( final Message message )
  |    {
  |          if( message instanceof ObjectMessage )
  |          {
  |             ObjectMessage objectMessage = (ObjectMessage)message;
  |             Serializable payload;
  |             try
  |             {
  |                payload = objectMessage.getObject();
  |                if( payload instanceof TypedData )
  |                {
  |                   m_incomingQueue.add( (TypedData)payload );
  |                }
  |             }
  |             catch( JMSException e )
  |             {
  |                m_handler.onConnectionException( new ConnectionException( e ) );
  |             }
  |          }
  |    }
  | 

The issue is that the payload is a TypedData Object, but loaded using the ClassLoader of the topic producer, not the subscriber.  In this particular instance my receiver is instantiated inside of a .war file (nested in a .ear file), but it appears to also happen when the receiver is loaded outside of the .war as well (e.g. instantiated from a Service Bean in the EJB context).

After modifying the code to naively cast the payload to the TypedData class without checking for type I receive the following:

  | 13:20:14,624 ERROR [ClientConsumer] RuntimeException was thrown from onMessage, 20345880406507537 will be redelivered
  | java.lang.ClassCastException: crc.stargate.common.TypedData cannot be cast to crc.stargate.common.TypedData
  | 	at crc.stargate.common.ReceiverFactory$TypedDataConnectionImpl.onMessage(ReceiverFactory.java:167)
  | 	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:885)
  | 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
  | 	at java.lang.Thread.run(Thread.java:619)
  | 

Let me know if there's anything else that would be helpful.
Thanks,
--Zack

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4229814#4229814

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4229814



More information about the jboss-user mailing list