ReportServer中的SMTP配置和java错误。没有为PKCS#12 KeyStore提供密码
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ReportServer中的SMTP配置和java错误。没有为PKCS#12 KeyStore提供密码相关的知识,希望对你有一定的参考价值。
我正在尝试为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
谢谢您的帮助。
答案
我自己解决了这个问题。
我检查了日志文件,发现了一条警告消息:"server certificate does NOT include an ID which matches the server name".
经过一些挖掘打开openssl.exe
。它给出了一个错误,它无法找到ssi.conf
文件,错误的路径。
固定它。
调度程序和邮件现在工作正常。 :)
以上是关于ReportServer中的SMTP配置和java错误。没有为PKCS#12 KeyStore提供密码的主要内容,如果未能解决你的问题,请参考以下文章
使用 T-SQL 的 ReportServer 数据库中的 s-s-rS 站点 URL
使用 O365 帐户连接到 Azure VM 中的 SMTP 中继失败