Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » javax.mail issues with multipart messages
javax.mail issues with multipart messages [message #1234547] Wed, 22 January 2014 08:32 Go to next message
Franck Mising name is currently offline Franck Mising name
Messages: 91
Registered: July 2009
Location: France
Member
I am running into issues trying to send multipart mail messages from Virgo webapps.
The exception is

javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:885)


I think the root cause is the one described here:

http://thecarlhall.wordpress.com/2009/10/27/javamail-in-osgi/

I have been trying everything I could think of and I am not getting anywhere, has anyone got any luck with this?

My last attempt was to make javax.activation & javax.mail available from the system bundle, hoping that that would allow activation to see javax.mail's META-INF/mailcap, but that didn't work.
It looks like I may need to create a custom bundle wrapping javax.activation & java.xmail, but the main concern then is having several sources for javax.activation...

I can't adjust the context classloader since javax.mail is being invoked from 3rd party bundles.

Any suggestions would be really appreciated...
Re: javax.mail issues with multipart messages [message #1258501 is a reply to message #1234547] Thu, 27 February 2014 12:59 Go to previous message
Martin Baumgartner is currently offline Martin Baumgartner
Messages: 9
Registered: June 2013
Junior Member
Which version of javax.mail do you use? I had the same issue, but could fix it. Use Javax.mail 1.5 as it ships a osgi-Manifest.MF and change the classloader.

			<dependency>
				<groupId>com.sun.mail</groupId>
				<artifactId>javax.mail</artifactId>
				<version>1.5.1</version>
				<exclusions>
					<exclusion>
						<artifactId>activation</artifactId>
						<groupId>javax.activation</groupId>
					</exclusion>
				</exclusions>
			</dependency>


https://community.oracle.com/message/6663195

Quote:

ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
javaMailSender.send(message);
Thread.currentThread().setContextClassLoader(oldClassLoader);

Ugly but works (for me).

Edit, I am not sure, if you need to change the classloader on virgo too. In our environment, we use virgo for development and websphere for production use. You should try without changing the classloader first.

[Updated on: Thu, 27 February 2014 13:06]

Report message to a moderator

Previous Topic:How are bundle jars copied to stage dir?
Next Topic:javax.xml jar processing takes more time in VIRGO
Goto Forum:
  


Current Time: Tue Sep 30 20:14:14 GMT 2014

Powered by FUDForum. Page generated in 0.07405 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software