我正在尝试为 ReportServer 中的计划报告配置 smtp。所以我的 smtp 配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<smtp>
<host>smtp.gmail.com</host>
<port>587</port>
<username>xxx@gmail.com</username>
<password>xxx</password>
<ssl>false</ssl>
<tls>
<enable>true</enable>
<require>false</require>
</tls>
</smtp>
<mail>
<sender>xxx@gmail.com</sender>
<forceSender>false</forceSender>
<encryptionPolicy>allow_mixed</encryptionPolicy>
</mail>
</configuration>
我使用 ssl true 端口 465 尝试了不同的配置。
https://forum.reportserver.net/viewtopic.php?pid=2291#p2291
我也在 Knowage BI 上使用了这个配置,它可以工作,但免费版本没有调度程序,所以我尝试了 ReportServer。
现在我无法弄清楚这个错误:
java.lang.RuntimeException: javax.mail.MessagingException: Could not convert socket to TLS;
nested exception is:
java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
at net.datenwerke.rs.scheduler.service.scheduler.mail.MailReportAction$1.handleException(MailReportAction.java:149)
at net.datenwerke.rs.core.service.mail.MailServiceImpl.sendMailSync(MailServiceImpl.java:243)
at net.datenwerke.rs.scheduler.service.scheduler.mail.MailReportAction.doExecute(MailReportAction.java:140)
at net.datenwerke.scheduler.service.scheduler.entities.AbstractAction.execute(AbstractAction.java:59)
at net.datenwerke.scheduler.service.scheduler.tasks.SchedulerTask.executeAction(SchedulerTask.java:495)
at net.datenwerke.scheduler.service.scheduler.tasks.SchedulerTask.executeActions(SchedulerTask.java:385)
at net.datenwerke.scheduler.service.scheduler.tasks.SchedulerTask.safeCall(SchedulerTask.java:209)
at net.datenwerke.scheduler.service.scheduler.tasks.SchedulerTask.call(SchedulerTask.java:101)
at net.datenwerke.scheduler.service.scheduler.tasks.SchedulerTask.call(SchedulerTask.java:1)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javax.mail.MessagingException: Could not convert socket to TLS;
nested exception is:
java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1918)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:652)
at javax.mail.Service.connect(Service.java:317)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at javax.mail.Transport.send0(Transport.java:194)
at javax.mail.Transport.send(Transport.java:124)
at net.datenwerke.rs.core.service.mail.MailServiceImpl.sendMailSync(MailServiceImpl.java:233)
... 11 more
Caused by: java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
at java.base/javax.net.ssl.DefaultSSLSocketFactory.throwException(SSLSocketFactory.java:263)
at java.base/javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:285)
at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:484)
at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1913)
... 18 more
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
at java.base/java.security.Provider$Service.newInstance(Provider.java:1831)
at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
at java.base/javax.net.ssl.SSLContext.getInstance(SSLContext.java:168)
at java.base/javax.net.ssl.SSLContext.getDefault(SSLContext.java:99)
at java.base/javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:123)
at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:479)
... 19 more
Caused by: java.lang.NullPointerException: No password supplied for PKCS#12 KeyStore.
at org.bouncycastle.jce.provider.JDKPKCS12KeyStore.engineLoad(Unknown Source)
at java.base/java.security.KeyStore.load(KeyStore.java:1479)
at java.base/sun.security.ssl.TrustStoreManager$TrustAnchorManager.loadKeyStore(TrustStoreManager.java:365)
at java.base/sun.security.ssl.TrustStoreManager$TrustAnchorManager.getTrustedCerts(TrustStoreManager.java:313)
at java.base/sun.security.ssl.TrustStoreManager.getTrustedCerts(TrustStoreManager.java:55)
at java.base/sun.security.ssl.TrustManagerFactoryImpl.engineInit(TrustManagerFactoryImpl.java:49)
at java.base/javax.net.ssl.TrustManagerFactory.init(TrustManagerFactory.java:278)
at java.base/sun.security.ssl.SSLContextImpl$DefaultManagersHolder.getTrustManagers(SSLContextImpl.java:1052)
at java.base/sun.security.ssl.SSLContextImpl$DefaultManagersHolder.<clinit>(SSLContextImpl.java:1022)
at java.base/sun.security.ssl.SSLContextImpl$DefaultSSLContext.<init>(SSLContextImpl.java:1197)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.security.Provider.newInstanceUtil(Provider.java:153)
at java.base/java.security.Provider$Service.newInstance(Provider.java:1824)
at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
at java.base/javax.net.ssl.SSLContext.getInstance(SSLContext.java:168)
at java.base/javax.net.ssl.SSLContext.getDefault(SSLContext.java:99)
at java.base/javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:123)
at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:479)
at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1913)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:652)
at javax.mail.Service.connect(Service.java:317)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at javax.mail.Transport.send0(Transport.java:194)
at javax.mail.Transport.send(Transport.java:124)
at net.datenwerke.rs.core.service.mail.MailServiceImpl.sendMailSync(MailServiceImpl.java:233)
at net.datenwerke.rs.core.service.mail.MailServiceImpl$1.run(MailServiceImpl.java:266)
... 3 more
所以我读了一些主题,也许我缺少证书,我不确定。这里有点新鲜。
附加信息:Java jdk_1.8.0_202 Windows 7
谢谢您的帮助。