Sending MimeMessage (nonserializable object) to JMS Queue

K

kitty

i,

I have to build an Email Queue, I am using Commons email and I need to
check the server before sending mails and if the server is down, store
the emails in a queue, I am converting my email to MimeMessage objects
to send to the JMS queue but it says MimeMessages are not serializable,
so I tried to use the writeTo method of MimeMessage, but that also
gives a NonSerializable exception:

My code:

Email email = new Email(); // Commons Email
email.buildMimeMessage();
MimeMessage msg = email.getMimeMessage();
System.out.println("email "+email);
FileOutputStream outStream = new
FileOutputStream("myfile.txt");
msg.writeTo(outStream);
FileInputStream inStream = new
FileInputStream("myfile.txt");
QueMessagingImpl.sendObjectMessage(inStream);

I get this error Message:
Uncategorized exception occured during JMS
processing; nested exception is weblogic.jms.common.JMSException: Error
serializing object; nested exception is
java.io.NotSerializableException: java.io.FileInputStream

All help is appreciated. Thanks in advance,
kitty
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top