我部署了一个spring微服务docker。我使用jaxwsproxyfactorybean来调用外部服务器(soap/wsdl),使用它一切正常http://externalserver:
JaxWsProxyFactoryBean jaxWsProxyFactoryBean = new JaxWsProxyFactoryBean();
jaxWsProxyFactoryBean.setAddress("http://externalServer");
...
当我在setaddress中调用https时,问题就出现了。
我使用keytool在keystore中注册了被调用服务器的密钥/证书,并保存到/root/.keystore(标准)中,从pfx导入它。当我尝试调用https时,出现以下错误:
org.apache.cxf.transport.https.SSLUtils : Default key managers cannot be initialized: Password must not be null
好吧,我少了一个密码。但是这个恶意密码放在哪里了?在application.yml中?系统内属性[密钥库中使用的密码是标准密码(changeit)]
编辑
下面是日志的快照:
DEBUG 1 --- [ XNIO-1 task-1] org.apache.cxf.transport.https.SSLUtils : The location of the key store has not been set via a system parameter or through configuration so the default value of /root/.keystore will be used.
DEBUG 1 --- [ XNIO-1 task-1] org.apache.cxf.transport.https.SSLUtils : The key store password has not been set via a system property or through configuration, reading data from the keystore will fail.
DEBUG 1 --- [ XNIO-1 task-1] org.apache.cxf.transport.https.SSLUtils : The key password has not been set via a system property or through configuration, reading data from the keystore will fail.
DEBUG 1 --- [ XNIO-1 task-1] org.apache.cxf.transport.https.SSLUtils : The keystore type has not been set in configuration so the default value of JKS will be used.
WARN 1 --- [ XNIO-1 task-1] org.apache.cxf.transport.https.SSLUtils : Default key managers cannot be initialized: Password must not be null
使用标准密钥库,但没有密码。
1条答案
按热度按时间2sbarzqh1#
从您的问题的评论部分查看我们的对话,我可以得出结论,您的apachecxf没有配置ssl。您需要做的是读取包含可信证书的密钥库并将其加载到
SSLContext
与trustmanagerfactory和trustmanager。下面是您可以尝试的配置示例:
这里还有一个cxf客户机的工作示例,用于基于ssl的单向和双向身份验证:github-示例apachecxf客户机ssl配置