[jboss-user] [JBoss Messaging] - ClassCastException when casting ObjectMessage object

chicken do-not-reply at jboss.com
Mon Feb 2 02:26:20 EST 2009


Dear all

I have a problem with JMS on JBoss 4.3.0.
My queue works well but whenever after I reload my application I could not cast the queue object to my custom message object (CustomMessageBean ):

ERROR: java.lang.ClassCastException: CustomMessageBean 

public void onMessage(Message message) {
  | 	try {
  | 		if (message instanceof ObjectMessage) {
  | 			String messageId = message.getJMSMessageID();
  | 			ObjectMessage qObjectMessage = (ObjectMessage) message;
  | 			CustomMessageBean mailBeanJMS = (CustomMessageBean) qObjectMessage
  | 					.getObject();
  | 			MailMgr receiverMailMgr = new MailMgr();
  | 			rlog.debug("messageid: " + messageId);
  | 			......
  | 
  | 		}
  | 	} catch (Exception e) {
  | 		System.out.println("ERROR: " + e.toString());
  | 	}
  | }

Here is configuration content for the queue:


  | <mbean code="org.jboss.jms.server.destination.QueueService"
  | name="jboss.messaging.destination:service=Queue,name=myQueue"
  |       xmbean-dd="xmdesc/Queue-xmbean.xml">
  |         <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
  |         <depends>jboss.messaging:service=PostOffice</depends>
  | </mbean>

To solve this problem, I have to restart JBoss Server every times I apply new source code!

please help me solve this problem.

Thanks in advance!

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

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



More information about the jboss-user mailing list