my dog learned polymorphism
The moose likes EJB and other Java EE Technologies and the fly likes MDB onMessage method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "MDB onMessage method" Watch "MDB onMessage method" New topic

MDB onMessage method

Sridhar Karanam

Joined: Feb 23, 2006
Posts: 2
Hi Everybody,

I am trying an application where i am sending an Object message from a helper class to a queue, i a using the following code for that :

QueueSession queueSession = getSession();
QueueSender queueSender = null;
Queue queue = null;
ObjectMessage object =null;
queue = getQueue();
queueSender = queueSession.createSender(queue);
object = queueSession.createObjectMessage(emp);

// here emp is a serializable java object which has two string variables empName and empDept

// some code

And in the MDB in the onMessage i check for an object message, but the below line gives me an error:

onMessage(Message message){
if (message instanceof ObjectMessage && ((ObjectMessage) message).getObject() instanceof Employee)
// some code

javax.jms.MessageFormatException: ClassNotFoundException: No ClassLoader
s found for: com.employee.details.Employee where Employee is the object whichi have sent as object message.

Anybody could give a suggestion, would be of great help for me.
Thanks for any help.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

Is the employee class included alon with MDB.

I agree. Here's the link:
subject: MDB onMessage method
It's not a secret anymore!