Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MDB onMessage method

 
Sridhar Karanam
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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;
try{
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

queueSender.send(getQueue(),object);
}catch(JMSException){
// 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.
Sridhar.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the employee class included alon with MDB.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic