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 08:06] by Moderator