Friday, October 8, 2010

Using GMail as Mail Server for Oracle SOA Suite 11g Notifications

Lucas Jellema has a good post about configuring SOA Suite 11g for sending email notifications with Google Mail, but unluckily, as he also noted, it was not working anymore. Nevertheless, that post demonstrated that Gmail could work as SMTP server for Oracle SOA and inspired me to dig more. In this post, I will share my configuration and the steps that I have made to have a working GMail SMTP server. The following are my suggested steps:
  1. Configure Workflow Notification Properties
  2. Configure Email Driver Properties
  3. Import the GMail's SSL certificate into Java keystore
  4. Remove "-Djavax.net.ssl.trustStore=%WL_HOME%\server\lib\DemoTrust.jks" in setDomainEnv.cmd

Configure Workflow Notification Properties

Right-click soa-infra > SOA Administration > Workflow Notification Properties
Set Workflow Notification to "All" or "Email".
Replace the "admin@javasoadev.com" and "action@javasoadev.com" with your own gmail address. You could replace both with just a single account. Don't be alarmed with my email address configuration that doesn't end with "gmail.com" because I have subscribe to Google Apps where I could have a customized email address.

Configure Email Driver Properties

Please see my configuration below which is presented as is for your reference.
Note that I am not using cleartext password but an encrypted indirect password as follows:

Import the GMail's SSL certificate into Java keystore

Follow the instructions on the following site up to the step of importing of the certificate to the keystore. Needless to say, import the certificate to the same JAVA_HOME that runs your weblogic server instance. http://confluence.atlassian.com/display/JIRA042/Using+Gmail+as+a+JIRA+Mail+Server

Remove "-Djavax.net.ssl.trustStore=%WL_HOME%\server\lib\DemoTrust.jks" in setDomainEnv.cmd

It seems that this command argument is affecting the way Weblogic locates trust as described in the following document: How WebLogic Server Locates Trust. With that argument, weblogic is not looking trust into JDK cacerts keystores.

Quick Testing...

Goto SOA Infrastructure>Service Engine>Human Workflow

Click "Notification Management" tab then click "Send Test Notification"... Enter something like the following values. Ensure that you gave a valid "Send To" email address.
Voila! Email is received accordingly...
Cheers and Thanks to Lucas!

5 comments:

  1. Hi ,
    To begin , this is a great post, Thanks,

    I did not have to remove "-Djavax.net.ssl.trustStore=%WL_HOME%\server\lib\DemoTrust.jks" in setDomainEnv.cmd . This was because i added gmail.cert to DemoTrust.jks too. The password for adding is DemoTrustKeyStorePassPhrase.

    ReplyDelete
  2. Hi Asish!

    That info is valuable.

    Thanks for the feedback,
    Rommel Pino

    ReplyDelete
  3. Updated the link on importing Gmail SSL certificate. http://confluence.atlassian.com/display/JIRA042/Using+Gmail+as+a+JIRA+Mail+Server

    ReplyDelete
  4. Its very helpful.

    I have done all the above mentioned steps. But i am getting following error. Please let me know how to resolve the issue?
    ------------------------------------------------
    Error while sending notification. Error while sending notification to email. Check the underlying exception and fix it. ; Error while sending notification. Error while sending notification to email. Check the underlying exception and fix it. ; EJB Exception: : java.lang.NullPointerException at oracle.bpel.services.notification.impl.asns.ASNSInteractionBean.send(ASNSInteractionBean.java:219) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310) at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37) at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54) at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50) at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at com.bea.core.repacka

    ReplyDelete