为Wso2EMM设置电子邮件通知

时间:2016-05-08 09:41:55

标签: wso2 wso2-emm

我正在尝试为WSO2 EMM配置电子邮件通知位,我一直遇到问题。我按照这里的指示去了

<EMM_HOME>/repository/conf/axis2/axis2.xml` and do this


    <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
    <parameter name="mail.smtp.host">smtp.gmail.com</parameter>
    <parameter name="mail.smtp.port">587</parameter>
    <parameter name="mail.smtp.starttls.enable">true</parameter>
    <parameter name="mail.smtp.auth">true</parameter>
    <parameter name="mail.smtp.user">synapse.demo.0</parameter>
    <parameter name="mail.smtp.password">mailpassword</parameter>
    <parameter name="mail.smtp.from">synapse.demo.0@gmail.com</parameter>
    </transportSender>

As Directed Here然后,我不断收到此错误

[2016-05-08 09:39:42,800] ERROR {org.wso2.carbon.email.sender.core.service.EmailSenderServiceImpl} -  Error occurred while delivering the message, subject: 'You have successfully been registered in WSO2 EMM', to: 'sososo@gmail.com'
org.apache.axis2.AxisFault: Error generating mail message
	at org.apache.axis2.transport.base.AbstractTransportSender.handleException(AbstractTransportSender.java:226)
	at org.apache.axis2.transport.mail.MailTransportSender.sendMessage(MailTransportSender.java:184)
	at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
	at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
	at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)
	at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
	at org.apache.axis2.client.ServiceClient.fireAndForget(ServiceClient.java:511)
	at org.apache.axis2.client.ServiceClient.fireAndForget(ServiceClient.java:488)
	at org.wso2.carbon.email.sender.core.service.EmailSenderServiceImpl$EmailSender.run(EmailSenderServiceImpl.java:117)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.axis2.AxisFault: Error creating mail message or sending it to the configured server
	at org.apache.axis2.transport.base.AbstractTransportSender.handleException(AbstractTransportSender.java:226)
	at org.apache.axis2.transport.mail.MailTransportSender.sendMail(MailTransportSender.java:505)
	at org.apache.axis2.transport.mail.MailTransportSender.sendMessage(MailTransportSender.java:175)
	... 12 more
Caused by: 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)
	at com.sun.mail.smtp.SMTPTransport.ehlo(SMTPTransport.java:847)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:384)
	at javax.mail.Service.connect(Service.java:297)
	at javax.mail.Service.connect(Service.java:156)
	at javax.mail.Service.connect(Service.java:105)
	at javax.mail.Transport.send0(Transport.java:168)
	at javax.mail.Transport.send(Transport.java:98)
	at org.apache.axis2.transport.mail.MailTransportSender.sendMail(MailTransportSender.java:494)
	... 13 more
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
	at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
	at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1916)
	at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:279)
	at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:273)
	at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1472)
	at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:213)
	at sun.security.ssl.Handshaker.processLoop(Handshaker.java:913)
	at sun.security.ssl.Handshaker.process_record(Handshaker.java:849)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1035)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1344)
	at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:721)
	at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:122)
	at com.sun.mail.util.TraceOutputStream.write(TraceOutputStream.java:101)
	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
	at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
	at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1418)
	... 22 more
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)
	at sun.security.validator.Validator.validate(Validator.java:260)
	at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:326)
	at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:231)
	at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:126)
	at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1454)
	... 33 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:196)
	at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:268)
	at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380)
	... 39 more

因此,在配置我的axis2_client.xml with the transportSender并在axis2.xml中对其进行评论后,我收到此错误

ERROR {org.wso2.carbon.email.sender.core.service.EmailSenderServiceImpl} -  Error occurred while delivering the message, subject: 'You have successfully been registered in WSO2 EMM', to: 'osososos@gmail.com'
org.apache.axis2.AxisFault: The system cannot infer the transport information from the mailto:ososososo@gmail.com URL.
	at     org.apache.axis2.description.ClientUtils.inferOutTransport(ClientUtils.java:81)
	at       org.apache.axis2.client.OperationClient.prepareMessageContext(OperationClient.java:288)
	at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:249)
	at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
	at org.apache.axis2.client.ServiceClient.fireAndForget(ServiceClient.java:511)
	at org.apache.axis2.client.ServiceClient.fireAndForget(ServiceClient.java:488)
	at org.wso2.carbon.email.sender.core.service.EmailSenderServiceImpl$EmailSender.run(EmailSenderServiceImpl.java:117)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)

我的配置如何显示的示例

<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
    <parameter name="mail.smtp.host">smtp.gmail.com</parameter>
    <parameter name="mail.smtp.port">587</parameter>
    <parameter name="mail.smtp.starttls.enable">true</parameter>
    <parameter name="mail.smtp.auth">true</parameter>
    <parameter name="mail.smtp.user">AppManager</parameter>
    <parameter name="mail.smtp.password">thegmailpassword</parameter>
    <parameter name="mail.smtp.from">sosososoo@gmail.com</parameter>
</transportSender>

1 个答案:

答案 0 :(得分:0)

请将mailto配置从axis2.xml移至axis2_client.xml。 您可以在下面找到一个示例配置。

<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
    <parameter name="mail.smtp.host">smtp.gmail.com</parameter>
    <parameter name="mail.smtp.port">587</parameter>
    <parameter name="mail.smtp.starttls.enable">true</parameter>
    <parameter name="mail.smtp.auth">true</parameter>
    <parameter name="mail.smtp.user">synapse.demo.0</parameter>
    <parameter name="mail.smtp.password">*********</parameter>
    <parameter name="mail.smtp.from">********</parameter>
</transportSender>