users@glassfish.java.net

Re: Error when sending email from a web application that runs on GlassFish

From: <glassfish_at_javadesktop.org>
Date: Wed, 13 May 2009 16:59:27 PDT

SOLUTION TO THIS PROBLEM:
----------------------------

The fix was given to me at the Sun forums, in the JavaMail discussion section.
So I want to share it with you in case someone else runs into the same problem.

The UnrecoverableKeyException is a manifestation of:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=6938

It is possible to work around this by adding two lines to the domain.xml of the application running on GlassFish.

1. Go to the following directory: <glassfish_folder>/domains/<your_domain>/config
2. Open 'domain.xml'
3. Look for the <java-config> section
4. Add the following lines:
<jvm-options>-Djavax.net.ssl.keyStorePassword=changeit</jvm-options>
<jvm-options>-Djavax.net.ssl.trustStorePassword=changeit</jvm-options>
5. Restart GlassFish

Sending emails through ports 587 and 465 should work now within a https-loaded page.

This applies to Grails Mail Plugin too.

Thanks everyone for your help.
[Message sent by forum member 'alecaste' (alecaste)]

http://forums.java.net/jive/thread.jspa?messageID=346173