简体   繁体   English

WSO2 ESB - 发送电子邮件

[英]WSO2 ESB - Sending Emails

I have a simple e-mail alert use case. 我有一个简单的电子邮件警报用例。

Have done the basic configurations in axis2.xml, and when i try the proxy the following exception shows up. 在axis2.xml中完成了基本配置,当我尝试代理时,会出现以下异常。

javax.mail.MessagingException: Can't send command to SMTP host;
nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1420)
at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1408)

Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:385)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)

TID: [-1234] [] [2016-07-27 14:19:30,758] ERROR
{org.apache.axis2.transport.mail.MailTransportSender} - Error creating mail message or sending it to the configured server {org.apache.axis2.transport.mail.MailTransportSender}

javax.mail.MessagingException: Can't send command to SMTP host;
nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1420)
at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1408)

The issue, I believe is I'm missing the following line of code in the configuration of ESB. 我相信这个问题是我在ESB的配置中缺少以下代码行。

Session session = Session.getInstance(props,
                new javax.mail.Authenticator() {
                    protected PasswordAuthentication getPasswordAuthentication() {
                        return new PasswordAuthentication("aaa", "bbb@0089");
                    }
                });

I have tried, tested successfully with a small java email app and javamailAPI including this authentication. 我尝试过使用一个小的java电子邮件应用程序和包含此身份验证的javamailAPI成功测试。

How can I do the same configuration in the <ESB_HOME>/repository/conf/axis2/axis2.xml 如何在<ESB_HOME>/repository/conf/axis2/axis2.xml执行相同的配置

Any suggestions will be very much helpful. 任何建议都会非常有帮助。 ESB 4.9.0 ESB 4.9.0

Thanks in advance. 提前致谢。

This seems to be because the required certificate is not available in the client trust store. 这似乎是因为客户端信任库中没有所需的证书。 Try again after importing it. 导入后再试一次。 To import the certificate to the trust store you can refer this blog . 要将证书导入信任库,您可以参考此博客

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM