Skip to Content
0

JMS - cannot send email by using ObjectMessage

May 24, 2017 at 08:57 AM

80

avatar image
Former Member

I have a object message and want to send it in JMS server

here is code:

<code>context =newInitialContext();

queueConnectionFactory=(QueueConnectionFactory)context.lookup(IBusinessConstants.JMS_QUEUE_CONNECTION_FACTORY_JNDI_NAME);

queueConnection = queueConnectionFactory.createQueueConnection();

queueSession = queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);Queue queue =(Queue)context.lookup(IBusinessConstants.JMS_QUEUE_JNDI_NAME);

log1.errorT("JMS Queue Obtained With Name: "+ queue.getQueueName());

queueSender = queueSession.createSender(queue);ObjectMessage objMsg = queueSession.createObjectMessage();

objMsg.setObject(myBean);

queueConnection.start();

queueSender.send(objMsg);           

log1.errorT("objMsg==>"+objMsg);
log1.errorT("objMsg.getObject()==>"+objMsg.getObject());

In logs view, objMsg is null but objMsg.getObject() has data. It's a root cause why cannot send email ? please suggest me possible solutions.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Richard Zhao
Dec 05, 2017 at 09:50 AM
0

Hello. Cuong According to your description. I am a little about your question. As You said objMsg is null How can you get Object from objMsg?

and the Scenario you have was you want to send an email. Does that mean "myBean" is email message? Could you provide us more detail about your issue so that we can help to do more analysis? thanks.

Share
10 |10000 characters needed characters left characters exceeded