The mailcap file in dsn.jar is not the problem.
The one from dsn.jar contains a content handler for
multipart/report, not for multipart/mixed which is used in my situation.
When I call saveChanges() on the message I get the problem.
I called it for a test in DataCmdHandler and then it found a
SharedFileInputStream which came from
MimeMessageInputStreamSource#getInputStream() I think.
So I think its a problem I James and not in the mail api or mailcap file.
Evert
Bernd Fondermann wrote:
> Hi Evert,
>
> This exception is often caused by bad mailcap files (see
>
http://java.sun.com/products/javabeans/glasgow/javadocs/javax/activation/MailcapCommandMap.html)
>
>
> User Sylvain Pedneault [17/Oct/06 03:43 PM] dealt with this problem,
too:
>
>>>>>
> 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....
> <<<<
>
> HTH,
>
> Bernd
>
> On 12/12/06, Evert Tigchelaar <[EMAIL PROTECTED]> wrote:
>> When I try to send an e-mail with an attachment I get an exception.
>> The mimetype is multipart/mixed and the message contains a
>> javax.mail.util.SharedByteArrayInputStream but MimeMultipart is
expected.
>>
>> Any ideas what could be the source of the problem?
>>
>> Thanks.
>>
>> p.s.
>> I attached the exception from the log with this e-mail as txt file.
>>
>>
>> 12/12/06 10:07:20 ERROR spoolmanager.root: Exception calling Forward:
>> MIME part of type "multipart/mixed;^M
>>
>> boundary="------------010203080503000503010803"" contains object of
>> type javax.mail.util.SharedByteArrayInputStream instead of
MimeMultipart
>>
>> javax.mail.MessagingException: MIME part of type "multipart/mixed;^M
>>
>> boundary="------------010203080503000503010803"" contains object of
>> type javax.mail.util.SharedByteArrayInputStream instead of
MimeMultipart
>>
>> at
>> javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1257)
>>
>> at
>> javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2012)
>>
>> at
>> javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1980)
>>
>> at
>>
org.apache.james.core.MimeMessageCopyOnWriteProxy.saveChanges(MimeMessageCopyOnWriteProxy.java:700)
>>
>>
>> at
>>
org.apache.james.transport.mailets.AbstractRedirect.service(AbstractRedirect.java:1048)
>>
>>
>> at
>>
org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:415)
>>
>>
>> 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(Unknown Source)
>>
>>
>>
>> 12/12/06 10:07:20 ERROR spoolmanager: Exception in processor <root>
>>
>> javax.mail.MessagingException: MIME part of type "multipart/mixed;^M
>>
>> boundary="------------010203080503000503010803"" contains object of
>> type javax.mail.util.SharedByteArrayInputStream instead of
MimeMultipart
>>
>> at
>> javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1257)
>>
>> at
>> javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2012)
>>
>> at
>> javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1980)
>>
>> at
>>
org.apache.james.core.MimeMessageCopyOnWriteProxy.saveChanges(MimeMessageCopyOnWriteProxy.java:700)
>>
>>
>> at
>>
org.apache.james.transport.mailets.AbstractRedirect.service(AbstractRedirect.java:1048)
>>
>>
>> at
>>
org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:415)
>>
>>
>> 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(Unknown Source)
>>
>> 12/12/06 10:07:20 ERROR spoolmanager: An error occurred processing
>> Mail1165914439454-21 through root
>>
>> 12/12/06 10:07:20 ERROR spoolmanager: Result was error
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]