JavaMail: getting javax.activation.UnsupportedDataTypeException

  6 posts   Feedicon  
Replies: 5 - Last Post: January 13, 2010 20:19
by: shannon
showing 1 - 6 of 6
 
Posted: January 08, 2010 16:21 by ambs
Hi all,

I have a java program from where I am trying to send a multipart/report MIME message, but I am getting the following exception:

Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/report;
boundary="----=_Part_2_15617301.1262629068438";
report-type=delivery-status
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:877)
at javax.activation.DataHandler.writeTo(DataHandler.java:302)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1383)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1743)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1719)
at mmhs.mcl.gcf.plugins.egp.ets.EMailObjectTools.buildNDRForGivenRecipients(EMailObjectTools.java:76)
... 13 more

I am using files mail.jar and dsn.jar from javamail v1.4.3, and java 6 update 12. Do you have any suggestion about what the problem might be?

Thank you for your help.

António Brás Silva
 
Posted: January 09, 2010 02:14 by shannon
Most likely dsn.jar isn't really in your CLASSPATH.

Try to reproduce the problem by modifying the msgsend.java demo program to sent
a multipart/report message. If you can get that to work, then there's a configuration
problem in your environment.

Are you running your program in some sort of application server?
 
Posted: January 11, 2010 12:18 by ambs
Hi Shannon, thank you for your answer.

The code that generates the exception is the following:
<code>
MultipartReport report = buildMimeReport( recips, supplementaryInfo);
MimeMessage mimeRep = new MimeMessage(session);
mimeRep.setSentDate(new Date());
mimeRep.setSubject("Undeliverable: " + mimeMsg.getSubject());
mimeRep.setRecipient(RecipientType.TO, messageOriginator);
mimeRep.addHeader("From", "GwTact delivery system <" + serverAddress + ">");
mimeRep.addHeader("Return-Path", "<>");
mimeRep.setContent(report);

ByteArrayOutputStream baos = new ByteArrayOutputStream();
mimeRep.writeTo(baos); // << EXCEPTION HAPPENS HERE
</code>

So I don't think there is a CLASSPATH problem with dsn.jar, otherwise a class not found exception should have been thrown at report creation (class MultipartReport would not be known)... by the way, I renamed dsn.jar as javamail-dsn-1.4.3.jar. I hope this has nothing to do with the problem...

As you can see, the report is created successfully. The exception comes up when I try and write it into a byte array output stream. Perhaps this is not supported?

This software is a JSE application running as a Windows service in a Windows 2003 server machine. In order to run as a service it was wrapped in a Tanuki software java service wrapper.

Any help would be very appreciated.
 
Posted: January 12, 2010 07:21 by shannon
What's "JSE"? Did you mean "Java SE"?

Most likely the ClassLoader in the Tanuki software isn't handling the resource lookup
properly, or isn't setting the thread's context class loader properly. For the latter, try
the workaround described here. If that fixes the problem, be sure to report the bug
to Tanuki (whoever/whatever that is).

 
Posted: January 13, 2010 18:03 by ambs
Ok, the problem was indeed the context class loader: it had a null value. After correcting it as described in the link you provided the program started running well.

Thanks for your help.

António Brás Silva
 
Posted: January 13, 2010 20:19 by shannon
Glad you got it working.

Again, please report the bug to Tanuki.
showing 1 - 6 of 6
Replies: 5 - Last Post: January 13, 2010 20:19
by: shannon
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120127.ac94057)
 
 
Close
loading
Please Confirm
Close