[ http://issues.apache.org/jira/browse/JAMES-447?page=comments#action_12443107 ] Sylvain Pedneault commented on JAMES-447: -----------------------------------------
I've been fighting with this issue all day (and just fixed it). I was getting "...contains object of type com.sun.mail.util.SharedByteArrayInputStream instead of MimeMultipart" error messages on e-mails I couldn't find anything wrong with. The errors started occuring after upgrading from JavaMail 1.3 to 1.4. To upgrade, I had simply swapped the "mail.jar" file with the newest version (not using the invididual narrower .jar files in the JavaMail distribution, but instead using the fat mail.jar one). But when I opened the JavaMail 1.4 distribution, I also noticed a "dsn.jar" file. Instinctively, and misreading the file name, I trashed our "dns.jar" library and dropped in that "dsn.jar" file from JavaMail 1.4! (notice dNS and dSn is not the same :) Well, turns out that not only was it not the replacement library I though it was, but dsn.jar also contains a "mailcap" file. As soon as I removed dsn.jar, the error disappeared. So, to all of you who get the SharedByteArrayInputStream-thing error, do you have JavaMail 1.4's "dsn.jar" file in your classpath? Could it be the source of the problem? Sure seems to have fixed it here.... > ClassCastException when storing multipart message without Msg ID > ---------------------------------------------------------------- > > Key: JAMES-447 > URL: http://issues.apache.org/jira/browse/JAMES-447 > Project: James > Issue Type: Bug > Components: MailStore & MailRepository > Affects Versions: 2.3.0a1 > Reporter: Bernd Fondermann > Assigned To: Stefano Bagnara > Fix For: 2.3.0a2 > > Attachments: MimeMessageUtilTest.java, test.zip > > > This problem occurs with James HEAD, but not with James 2.2.0 > When sending a multipart message which has no Message-ID header field to an > internal user, the following exception is raised: > javax.mail.MessagingException: Exception caught while storing Message > Container: javax.mail.MessagingException: MIME part of type "multipart/mixed; > boundary="bmQykoPt9wvlXeBFetOZnNCi/trubV+f25KeVm5YJYo="" contains object of > type com.sun.mail.util.SharedByteArrayInputStream instead of MimeMultipart > at > org.apache.james.mailrepository.AvalonMailRepository.store(AvalonMailRepository.java:329) > at > org.apache.james.transport.mailets.ToMultiRepository.storeMail(ToMultiRepository.java:226) > at > org.apache.james.transport.mailets.ToMultiRepository.service(ToMultiRepository.java:151) > at > org.apache.james.transport.mailets.LocalDelivery.service(LocalDelivery.java:64) > at > org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:414) > at > org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:397) > at > org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:306) > at java.lang.Thread.run(Thread.java:534) > the exception is thrown within JavaMail, the last related James call is in > line 67 of MimeMessageUtil: > public static void writeTo(MimeMessage message, OutputStream headerOs, > OutputStream bodyOs, String[] ignoreList) throws IOException, > MessagingException { > if (message instanceof MimeMessageCopyOnWriteProxy) { > MimeMessageCopyOnWriteProxy wr = (MimeMessageCopyOnWriteProxy) > message; > MimeMessage m = wr.getWrappedMessage(); > if (m instanceof MimeMessageWrapper) { > MimeMessageWrapper wrapper = (MimeMessageWrapper)m; > wrapper.writeTo(headerOs, bodyOs, ignoreList); > return; > } > } else if (message instanceof MimeMessageWrapper) { > MimeMessageWrapper wrapper = (MimeMessageWrapper)message; > wrapper.writeTo(headerOs, bodyOs, ignoreList); > return; > } > if(message.getMessageID() == null) { > message.saveChanges(); //// <====== exception thrown from here > } > the exception is going away if at least one of the following is done: > + a message id header field is added when sending the message > + the receiver is not a James internal account > + the message mime type is changed from "multipart" to something else > + James 2.2.0 is being used. > I did the first one for the stress test tool, but wonder if a Message-ID is > mandatory. > I debugged this problem but did not find neither a fix nor the critical > change from 2.2.0 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]