Re: running sun and gnu javamail implementation in parallel out of tomcat SSL'ed web-app

Chris Burdess <[email protected]>
Newsgroups gmane.comp.java.classpath.extensions.javamail
Organization the mireval massive
Message-ID <[email protected]>
Ralf Hauser wrote:
> Using your javamail and gnu crypto to send out TLS protected mails appears
> to very attractive. Not being brave enough to immediately phase out the sun
> implementation altogether:
> Is there a way to tell my program that for certain mails, it shall use your
> implementation and for other destinations sun's?
> 
> How to avoid class-loader problems in this case?

Normally, it would not be possible. The Session implementation only supports
one implementation of a provider for a given protocol. If you're a
classloader wizard you may be able to work out how to load two different
implementations of JavaMail into memory at the same time, but I don't advise
you to do this.

> Also how to avoid disturbing the tomcat web-app doing that if it uses an SSL
> factory on its own?
> 
> I do know the approach of
> http://www.javaworld.com/javatips/jw-javatip115.html and
> http://www.portaljava.com/home/modules.php?name=Forums&file=viewtopic&p=2049
> 2 (see also http://issues.apache.org/jira/browse/JAMES-304), but those
> exactly have the issue that they interfere with my tomcat.

GNU JavaMail will use a configured JSSE provider, so if Tomcat has one set
up it will use that. The provider must support SSLv3 and TLSv1 (these are
the same thing).

If your IMAP/POP3/SMTP server supports TLS then it will be used, no
configuration necessary. Otherwise, consult the provider documentation for
session options you can set; the GNU provider options are different from
Sun's, especially the socketFactory.class options etc do not exist for GNU
providers.
-- 
Chris Burdess
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.