Search code examples
emailwebspherelocalhost

Unable to send mail from localhost (websphere application server)


I am trying to send an email from localhost. I am using websphere application server. I get following error:

[2/21/13 9:21:24:407 IST] 00000036 SystemOut     O DEBUG: setDebug: JavaMail version 1.4ea
[2/21/13 9:21:24:502 IST] 00000036 SystemOut     O DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
[2/21/13 9:21:24:527 IST] 00000036 SystemOut     O DEBUG SMTP: useEhlo true, useAuth true
[2/21/13 9:21:24:527 IST] 00000036 SystemOut     O DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false
[2/21/13 9:21:25:212 IST] 00000036 WSX509TrustMa E   CWPKI0022E: SSL HANDSHAKE FAILURE:  A signer with SubjectDN "CN=smtp.gmail.com, O=Google Inc, L=Mountain View, ST=California, C=US" was sent from target host:port "*:9043".  The signer may need to be added to local trust store "C:/Program Files (x86)/IBM/SDP/runtimes/base_v7/profiles/was70profile1/config/cells/drunkendeath-PCNode01Cell/nodes/drunkendeath-PCNode01/trust.p12" located in SSL configuration alias "NodeDefaultSSLSettings" loaded from SSL configuration file "security.xml".  The extended error message from the SSL handshake exception is: "PKIX path building failed: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; internal cause is: 
    java.security.cert.CertPathValidatorException: The certificate issued by OU=Equifax Secure Certificate Authority, O=Equifax, C=US is not trusted; internal cause is: 
    java.security.cert.CertPathValidatorException: Certificate chaining error".
[2/21/13 9:21:25:214 IST] 00000036 SystemOut     O DEBUG SMTP: exception reading response: javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.g: PKIX path building failed: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; internal cause is: 
    java.security.cert.CertPathValidatorException: The certificate issued by OU=Equifax Secure Certificate Authority, O=Equifax, C=US is not trusted; internal cause is: 
    java.security.cert.CertPathValidatorException: Certificate chaining error
[2/21/13 9:21:25:504 IST] 00000036 servlet       I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [IBMBookSalesProjectEAR] [/IBMBookSalesProject] [/order_success.jsp]: Initialization successful.
[2/21/13 9:21:25:215 IST] 00000036 SystemErr     R javax.mail.MessagingException: Exception reading response;
  nested exception is:
    javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.g: PKIX path building failed: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; internal cause is: 
    java.security.cert.CertPathValidatorException: The certificate issued by OU=Equifax Secure Certificate Authority, O=Equifax, C=US is not trusted; internal cause is: 
    java.security.cert.CertPathValidatorException: Certificate chaining error
[2/21/13 9:21:25:216 IST] 00000036 SystemErr     R  at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1462)
[2/21/13 9:21:25:216 IST] 00000036 SystemErr     R  at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1260)
[2/21/13 9:21:25:216 IST] 00000036 SystemErr     R  at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
[2/21/13 9:21:25:216 IST] 00000036 SystemErr     R  at javax.mail.Service.connect(Service.java:275)
[2/21/13 9:21:25:216 IST] 00000036 SystemErr     R  at javax.mail.Service.connect(Service.java:156)
[2/21/13 9:21:25:216 IST] 00000036 SystemErr     R  at com.tgmc.mail.MailSupport.sendMail(MailSupport.java:82)
[2/21/13 9:21:25:216 IST] 00000036 SystemErr     R  at com.tgmc.mail.MailSupport.sendMail(MailSupport.java:43)
[2/21/13 9:21:25:217 IST] 00000036 SystemErr     R  at com.tgmc.servlets.CompleteTransactionServlet.doPost(CompleteTransactionServlet.java:143)
[2/21/13 9:21:25:217 IST] 00000036 SystemErr     R  at com.tgmc.servlets.CompleteTransactionServlet.doGet(CompleteTransactionServlet.java:44)
[2/21/13 9:21:25:217 IST] 00000036 SystemErr     R  at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
[2/21/13 9:21:25:217 IST] 00000036 SystemErr     R  at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
[2/21/13 9:21:25:217 IST] 00000036 SystemErr     R  at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1449)
[2/21/13 9:21:25:217 IST] 00000036 SystemErr     R  at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:790)
[2/21/13 9:21:25:217 IST] 00000036 SystemErr     R  at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
[2/21/13 9:21:25:218 IST] 00000036 SystemErr     R  at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
[2/21/13 9:21:25:218 IST] 00000036 SystemErr     R  at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)
[2/21/13 9:21:25:218 IST] 00000036 SystemErr     R  at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)
[2/21/13 9:21:25:218 IST] 00000036 SystemErr     R  at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)
[2/21/13 9:21:25:218 IST] 00000036 SystemErr     R  at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
[2/21/13 9:21:25:218 IST] 00000036 SystemErr     R  at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
[2/21/13 9:21:25:219 IST] 00000036 SystemErr     R  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
[2/21/13 9:21:25:219 IST] 00000036 SystemErr     R  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
[2/21/13 9:21:25:219 IST] 00000036 SystemErr     R  at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
[2/21/13 9:21:25:219 IST] 00000036 SystemErr     R  at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1772)
[2/21/13 9:21:25:219 IST] 00000036 SystemErr     R  at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
[2/21/13 9:21:25:219 IST] 00000036 SystemErr     R  at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[2/21/13 9:21:25:219 IST] 00000036 SystemErr     R  at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[2/21/13 9:21:25:220 IST] 00000036 SystemErr     R  at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
[2/21/13 9:21:25:220 IST] 00000036 SystemErr     R  at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)
[2/21/13 9:21:25:220 IST] 00000036 SystemErr     R  at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
[2/21/13 9:21:25:220 IST] 00000036 SystemErr     R  at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)
[2/21/13 9:21:25:220 IST] 00000036 SystemErr     R  at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)
[2/21/13 9:21:25:220 IST] 00000036 SystemErr     R Caused by: javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.g: PKIX path building failed: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; internal cause is: 
    java.security.cert.CertPathValidatorException: The certificate issued by OU=Equifax Secure Certificate Authority, O=Equifax, C=US is not trusted; internal cause is: 
    java.security.cert.CertPathValidatorException: Certificate chaining error
[2/21/13 9:21:25:221 IST] 00000036 SystemErr     R  at com.ibm.jsse2.n.a(n.java:42)
[2/21/13 9:21:25:221 IST] 00000036 SystemErr     R  at com.ibm.jsse2.sc.a(sc.java:277)
[2/21/13 9:21:25:221 IST] 00000036 SystemErr     R  at com.ibm.jsse2.gb.a(gb.java:354)
[2/21/13 9:21:25:221 IST] 00000036 SystemErr     R  at com.ibm.jsse2.gb.a(gb.java:292)
[2/21/13 9:21:25:221 IST] 00000036 SystemErr     R  at com.ibm.jsse2.hb.a(hb.java:118)
[2/21/13 9:21:25:222 IST] 00000036 SystemErr     R  at com.ibm.jsse2.hb.a(hb.java:162)
[2/21/13 9:21:25:222 IST] 00000036 SystemErr     R  at com.ibm.jsse2.gb.n(gb.java:262)
[2/21/13 9:21:25:222 IST] 00000036 SystemErr     R  at com.ibm.jsse2.gb.a(gb.java:177)
[2/21/13 9:21:25:222 IST] 00000036 SystemErr     R  at com.ibm.jsse2.sc.a(sc.java:71)
[2/21/13 9:21:25:222 IST] 00000036 SystemErr     R  at com.ibm.jsse2.sc.g(sc.java:167)
[2/21/13 9:21:25:222 IST] 00000036 SystemErr     R  at com.ibm.jsse2.sc.a(sc.java:170)
[2/21/13 9:21:25:222 IST] 00000036 SystemErr     R  at com.ibm.jsse2.e.read(e.java:38)
[2/21/13 9:21:25:223 IST] 00000036 SystemErr     R  at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:97)
[2/21/13 9:21:25:223 IST] 00000036 SystemErr     R  at java.io.BufferedInputStream.fill(BufferedInputStream.java:229)
[2/21/13 9:21:25:223 IST] 00000036 SystemErr     R  at java.io.BufferedInputStream.read(BufferedInputStream.java:248)
[2/21/13 9:21:25:223 IST] 00000036 SystemErr     R  at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:75)
[2/21/13 9:21:25:223 IST] 00000036 SystemErr     R  at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1440)
[2/21/13 9:21:25:223 IST] 00000036 SystemErr     R  ... 31 more
[2/21/13 9:21:25:223 IST] 00000036 SystemErr     R Caused by: com.ibm.jsse2.util.g: PKIX path building failed: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; internal cause is: 
    java.security.cert.CertPathValidatorException: The certificate issued by OU=Equifax Secure Certificate Authority, O=Equifax, C=US is not trusted; internal cause is: 
    java.security.cert.CertPathValidatorException: Certificate chaining error
[2/21/13 9:21:25:224 IST] 00000036 SystemErr     R  at com.ibm.jsse2.util.e.b(e.java:78)
[2/21/13 9:21:25:224 IST] 00000036 SystemErr     R  at com.ibm.jsse2.util.e.b(e.java:45)
[2/21/13 9:21:25:224 IST] 00000036 SystemErr     R  at com.ibm.jsse2.util.d.a(d.java:12)
[2/21/13 9:21:25:225 IST] 00000036 SystemErr     R  at com.ibm.jsse2.gc.a(gc.java:15)
[2/21/13 9:21:25:225 IST] 00000036 SystemErr     R  at com.ibm.jsse2.gc.checkServerTrusted(gc.java:48)
[2/21/13 9:21:25:225 IST] 00000036 SystemErr     R  at com.ibm.ws.ssl.core.WSX509TrustManager.checkServerTrusted(WSX509TrustManager.java:310)
[2/21/13 9:21:25:225 IST] 00000036 SystemErr     R  at com.ibm.jsse2.hb.a(hb.java:116)
[2/21/13 9:21:25:225 IST] 00000036 SystemErr     R  ... 43 more
[2/21/13 9:21:25:225 IST] 00000036 SystemErr     R Caused by: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; internal cause is: 
    java.security.cert.CertPathValidatorException: The certificate issued by OU=Equifax Secure Certificate Authority, O=Equifax, C=US is not trusted; internal cause is: 
    java.security.cert.CertPathValidatorException: Certificate chaining error
[2/21/13 9:21:25:226 IST] 00000036 SystemErr     R  at com.ibm.security.cert.PKIXCertPathBuilderImpl.engineBuild(PKIXCertPathBuilderImpl.java:411)
[2/21/13 9:21:25:226 IST] 00000036 SystemErr     R  at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:258)
[2/21/13 9:21:25:226 IST] 00000036 SystemErr     R  at com.ibm.jsse2.util.e.b(e.java:51)
[2/21/13 9:21:25:227 IST] 00000036 SystemErr     R  ... 49 more
[2/21/13 9:21:25:227 IST] 00000036 SystemErr     R Caused by: java.security.cert.CertPathValidatorException: The certificate issued by OU=Equifax Secure Certificate Authority, O=Equifax, C=US is not trusted; internal cause is: 
    java.security.cert.CertPathValidatorException: Certificate chaining error
[2/21/13 9:21:25:227 IST] 00000036 SystemErr     R  at com.ibm.security.cert.BasicChecker.<init>(BasicChecker.java:111)
[2/21/13 9:21:25:228 IST] 00000036 SystemErr     R  at com.ibm.security.cert.PKIXCertPathValidatorImpl.engineValidate(PKIXCertPathValidatorImpl.java:176)
[2/21/13 9:21:25:228 IST] 00000036 SystemErr     R  at com.ibm.security.cert.PKIXCertPathBuilderImpl.myValidator(PKIXCertPathBuilderImpl.java:732)
[2/21/13 9:21:25:228 IST] 00000036 SystemErr     R  at com.ibm.security.cert.PKIXCertPathBuilderImpl.buildCertPath(PKIXCertPathBuilderImpl.java:649)
[2/21/13 9:21:25:228 IST] 00000036 SystemErr     R  at com.ibm.security.cert.PKIXCertPathBuilderImpl.buildCertPath(PKIXCertPathBuilderImpl.java:595)
[2/21/13 9:21:25:228 IST] 00000036 SystemErr     R  at com.ibm.security.cert.PKIXCertPathBuilderImpl.engineBuild(PKIXCertPathBuilderImpl.java:357)
[2/21/13 9:21:25:228 IST] 00000036 SystemErr     R  ... 51 more
[2/21/13 9:21:25:228 IST] 00000036 SystemErr     R Caused by: java.security.cert.CertPathValidatorException: Certificate chaining error
[2/21/13 9:21:25:230 IST] 00000036 SystemErr     R  at com.ibm.security.cert.CertPathUtil.findIssuer(CertPathUtil.java:298)
[2/21/13 9:21:25:230 IST] 00000036 SystemErr     R  at com.ibm.security.cert.BasicChecker.<init>(BasicChecker.java:108)
[2/21/13 9:21:25:230 IST] 00000036 SystemErr     R  ... 56 more

Moreover I keep on getting https error when I open my project in chrome. How do I resolve it? please help.


Solution

  • You are trying to send an email to a server that uses SSL (in this case looks like gmail), WebSphere does not trust the certificate and that is why you are failing.

    You need to import Google certificate into the WebSphere's trust store and it should be working for you.

    The easiest way is to use Retrieve from port which lets you give the host name and port and WebSphere will get the certificate for you.