users@glassfish.java.net

Re: Issues with JavaMail in OSGi Bundle

From: <glassfish_at_javadesktop.org>
Date: Sat, 07 Aug 2010 06:45:39 PDT

Hello again -

I am still having major problems getting this to work in an OSGi bundle for me (via GF 3.0.1).
I have exhausted quite a few roads on this and am hitting a brick wall.

I have checked the mail.jar bundle that comes with gf, and all seems to be OK in there. I have updated my bnd files to match what is exported there as well (even directly importing package com.sun.mail.handlers;uses:="javax.activation,javax.mail.internet,javax.mail";version="1.4.3" to see if that would help).

I know the handlers are available - I even created one and tested it's dataflavor against the message that was created:

DataContentHandler dhmm = new com.sun.mail.handlers.multipart_mixed();
DataFlavor[] dtf = dhmm.getTransferDataFlavors();
for (DataFlavor tmpdf : dtf) {
        log.debug(" isSupported? " + tmpdf.getMimeType() + ":" + message.getDataHandler().isDataFlavorSupported(tmpdf));
}

And it shows it is supported: isSupported? multipart/mixed:true

I have also tried getting the DataHandler from the message that was created, created a new command map that mimics mailcap and setCommandMap on the DataHandler with it, and still no avail - I always get:

Caused by: javax.mail.MessagingException: IOException while sending message;
  nested exception is:
        javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;

Has anyone else using Javamail inside a bundle not seen this issue as well? I have seen how some people combine the jars, make sure they jars are in the same place, but it seems with the bundle included in GF - the jars for JAF and Javamail are already combined - so that wouldn't be a solution here.

I was even thinking of just embedding the jar with my bundle itself, but that didn't seem to help much either (using the Bundle-Classpath to point to the embedded jar).

Any help is appreciated.

Thanks!

--
Robert B. Weeks
[Message sent by forum member 'vaiism']
http://forums.java.net/jive/thread.jspa?messageID=479588