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.
Lothar Kimmeringer - 09 Sep 2006 12:53 GMT
> I guess it caused by different version of javamail/activation, but
> seems they are loaded from the same jar
[quoted text clipped - 7 lines]
>
> Any idea about this problem.
Seems that Eclipse is setting the Content-Handler differently.
This can be done with the class CommandMap.
Regards, Lothar

Signature
Lothar Kimmeringer E-Mail: spamfang@kimmeringer.de
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)
Always remember: The answer is forty-two, there can only be wrong
questions!