users@glassfish.java.net

Re: MDB00037: Message-driven bean invocation exception: [javax.ejb.EJBException

From: <glassfish_at_javadesktop.org>
Date: Mon, 22 Feb 2010 06:17:35 PST

>
> ObjectMessage objectMessage = ((ObjectMessage)
> message).getObject();
>
> resulted in a different compilation error as
> follows:
>
> Incompatible types
> required: javax.jms.objectMessage
> found: java.io.Serializable
> sing the wrong class?

You need two separate casts. Since this gets tortuous with all those brackets, split it up:

ObjectMessage om = (ObjectMessage) message;
Serializable objectData = om.getObject();
Customer myCustomer = (Customer) objectData;

This should make it clearer what is happening in each step.

I'll leave converting that to a single expression with two casts and lots of brackets as an exercise for the reader...

Nigel
[Message sent by forum member 'nigeldeakin' (nigel.deakin_at_sun.com)]

http://forums.java.net/jive/thread.jspa?messageID=388005