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.
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.