简体   繁体   English

尝试通过 SSL 访问 Web 服务的 Java Web 服务客户端 - TrustManagerFactoryImpl 未初始化

[英]java web service client trying to access web service through SSL - TrustManagerFactoryImpl is not initialized

I'm a web service client and I'm connecting to the web service through SSL.我是一个 Web 服务客户端,我通过 SSL 连接到 Web 服务。

It's a 2-way SSL and the producer has shared the certificate.这是一个 2 向SSL ,生产者已共享证书。 I did run the InstallCert.java, got the alias and created a Keystore.我确实运行了 InstallCert.java,获得了别名并创建了一个密钥库。 I'm using weblogic application server and I have placed my Keystore in it.我正在使用weblogic应用程序服务器,并将我的密钥库放在其中。

Now when I run it, I'm getting an error,现在当我运行它时,我收到一个错误,

Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: 
                                      TrustManagerFactoryImpl is not initialized

Before this I could see that it is trying to load the identity certificate and the private key.在此之前,我可以看到它正在尝试加载身份证书和私钥。 But as per standards the producer isn't willing to share the private key with us.但是按照标准,生产者不愿意与我们共享私钥。

Any suggestion on this would be of great help to me.对此的任何建议都会对我有很大帮助。 Thanks.谢谢。

I resolved it.我解决了。 I added my .cer file to cacerts which is referred by the weblogic server (Using keytool import).我将我的 .cer 文件添加到 weblogic 服务器引用的 cacerts(使用 keytool 导入)。 In the keystores section, I kept the default option (Demo identity and Demo trust).在密钥库部分,我保留了默认选项(演示身份和演示信任)。 In the SSL section, I went to advanced, click on the checkbox ("Use JSSE SSL").在 SSL 部分,我转到高级,单击复选框(“使用 JSSE SSL”)。 It worked.有效。

I had this issue connecting to a MySQL database that requires SSL to connect.我在连接到需要 SSL 才能连接的 MySQL 数据库时遇到了这个问题。

It turns out, for me, the driver version needed to be updated in order to properly-handle the trust store configuration in the JDBC URL.事实证明,对我来说,需要更新驱动程序版本才能正确处理 JDBC URL 中的信任存储配置。

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

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