Hello Sahoo -
Thank you very much for the information below - I had messed with the ClassLoaders trying to get this to work, but was a bit leery in doing so at first.
We set the Session and send the message in 2 different methods, and working with your suggestions below, I did finally get it to work.
Again, thank you very much for your input!
Is the description given below correct?
You have an OSGi bundle which is making use of JavaMail APIs. When your bundle calls certain JavaMail API, JavaMail is using javax.activation, which in turn is failing to locate META-INF/mailcap resources bundled as part of JavaMail bundle resulting in UnsupportedDataTypeException.
If this is correct, can I request you to try setting the context class loader temporarily to JavaMail bundle's class loader before calling JavaMail API and resetting back to what it used to be after the call. e.g., something like this:
void foo() {
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(javax.mail.Session.class.getClassLoader());
// now call JavaMail API
...
} finally {
Thread.currentThread().setContextClassLoader(tcl);
}
}
Your bundle should import javax.mail package.
--
Robert B. Weeks
rweeks_at_ext-inc.com<mailto:rweeks_at_ext-inc.com>