web-services - 从 Axis2 Web 服务内部设置 javax.net.ssl.trustStore

标签 web-services ssl wso2 apache-axis truststore

我编写了一个 Web 服务 A,它调用位于 https://servername:9443/services/AuthenticationAdmin 中的另一个 Web 服务 B。 . 为了验证服务器证书,我设置了信任库:

System.setProperty("javax.net.ssl.trustStore", "/home/wso2/wso2/bin/wso2bam-2.5.0/repository/resources/security/wso2carbon.jks");
System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");

如您所见,我已尝试引用位​​于部署 Web 服务 A 的主机的文件系统中的信任库。但是当调用网络服务 B 时(从纽约网络服务 A)我收到以下错误:

<soapenv:Reason xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
  <soapenv:Text xml:lang="en-US">Connection has been shutdown: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty</soapenv:Text>
</soapenv:Reason>

之后,我尝试将信任库文件放入 .aar 文件中,并按如下方式引用它:

System.setProperty("javax.net.ssl.trustStore", "/wso2carbon.jks");

甚至

System.setProperty("javax.net.ssl.trustStore", "wso2carbon.jks");

但没有成功。

如何从 Axis2 网络服务内部设置信任库?

提前致谢。

最佳答案

这意味着路径不正确或者 wso2carbon.jks 文件没有读取权限。

您可以在 [1] 中找到有关如何设置 trustStore 的示例。参见类 ServiceInvoker

[1] - http://hi-my-world.blogspot.com/2014/04/how-to-write-client-to-invoke-wso2.html

关于web-services - 从 Axis2 Web 服务内部设置 javax.net.ssl.trustStore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29796285/

相关文章:

java - Android - Retrofit2 - java.security.cert.CertPathValidatorException : Trust anchor for certification path not found

c# - Web 引用代理是指定的字段

java - 如何将下面的 xsd 文件转换为 java 文件?

c# - Apple Wallet Passs 后端 Web 服务

objective-c - iOS 中的 SOAP - 从 XML 中提取多个字符串

PHP 在连接时接收 SSL 证书参数

Java 微服务无法与 AWS Athena 客户端通信 : Handshake_Failure

server - WSO2 IS : how to allow anonymous request to OIDC . 众所周知/openid 配置

docker - WSO2-APIM(v1.9.1)从Docker运行,无法使用通用URL创建新的API

jsp - 使用外部 Jar 文件网络应用程序/Stratos Live