javamail runs well in eclipse IDE but gets exception in JRE

X

xukai04

Recently I am using Javamail in a project. It works great in myeclipse
IDE, but always get exception in the run time environment as a jar.
i.e., javamail behaves differently in IDE and system JRE.
for example,
MimePart.getContent() returns String in IDE, but returns
SharedByteArrayInputstream in JRE.
similarly,
new MimeMessage(session, inputstream) works fine for multipart in
IDE, but in JRE, I get the error:
javax.mail.MessagingException: MIME part of type
"multipart/related; boundary="======ADSA134511"
contains object of type com.sun.mail.util.SharedByteArrayInputStream
instead of MimeMultipart

I guess it caused by different version of javamail/activation, but
seems they are loaded from the same jar
(I called the following code to check the path of jar:
URL location =
Transport.class.getProtectionDomain().getCodeSource().getLocation();

logger.debug("Transport.class.getProtectionDomain().getCodeSource().getLocation():
" + location.toString());
)

Any idea about this problem.
Thanks a lot.
 
L

Lothar Kimmeringer

I guess it caused by different version of javamail/activation, but
seems they are loaded from the same jar
(I called the following code to check the path of jar:
URL location =
Transport.class.getProtectionDomain().getCodeSource().getLocation();

logger.debug("Transport.class.getProtectionDomain().getCodeSource().getLocation():
" + location.toString());
)

Any idea about this problem.

Seems that Eclipse is setting the Content-Handler differently.
This can be done with the class CommandMap.


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 

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,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top