首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >signaturePropFile的Axis2/rampart密码学问题

signaturePropFile的Axis2/rampart密码学问题
EN

Stack Overflow用户
提问于 2010-07-19 19:40:09
回答 1查看 4.2K关注 0票数 0

我对必须使用WS-Security的WebService客户端有问题。我的客户端是用axis2编写的。当我没有启用加密(当然是使用我的服务器仿真器)时,它就会起作用。我通过添加到axis.xml启用了加密

代码语言:javascript
复制
<!--Signature and Encryption : Using the request's certificate-->
<module ref="rampart" />

<parameter name="OutflowSecurity">
  <action>
    <items>Signature</items>
    <user>mn</user>
      <passwordCallbackClass>PWCallback</passwordCallbackClass>
      <signaturePropFile>client.properties</signaturePropFile>
    <signatureKeyIdentifier>SKIKeyIdentifier</signatureKeyIdentifier>
    <signatureParts>{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body</signatureParts>
  </action>
</parameter> 

现在,当我使用参数从Eclipse调用客户端时:

代码语言:javascript
复制
-Daxis2.xml=axis-repo/conf/axis2.xml -Daxis2.repo=axis-repo

我得到了:

代码语言:javascript
复制
org.apache.axis2.AxisFault: CryptoFactory: Cannot load properties: client.properties
at org.apache.rampart.handler.WSDoAllSender.processMessage(WSDoAllSender.java:67)
at org.apache.rampart.handler.WSDoAllHandler.invoke(WSDoAllHandler.java:72)
at org.apache.axis2.engine.Phase.invoke(Phase.java:318)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:251)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:416)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
...
Caused by: java.lang.RuntimeException: CryptoFactory: Cannot load properties: client.properties
at org.apache.ws.security.components.crypto.CryptoFactory.getProperties(CryptoFactory.java:258)
at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:171)
at org.apache.ws.security.handler.WSHandler.loadSignatureCrypto(WSHandler.java:431)
at org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:137)
at org.apache.rampart.handler.WSDoAllSender.processBasic(WSDoAllSender.java:201)
at org.apache.rampart.handler.WSDoAllSender.processMessage(WSDoAllSender.java:64)
... 9 more
Caused by: java.lang.NullPointerException
at org.apache.ws.security.components.crypto.CryptoFactory.getProperties(CryptoFactory.java:253)
... 14 more

我能够以File对象的形式打开client.properties。我尝试将这个文件放在不同的目录中,或者更改它的名称以使用完整路径(在Windows上工作时都使用斜杠和反斜杠),但都没有帮助。

我的client.properties文件如下所示:

代码语言:javascript
复制
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=mn
org.apache.ws.security.crypto.merlin.file=mn_keystore.ks

你知道我为什么会得到这个错误吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-07-21 17:29:28

我发现必须将client.propertiesmn_keystore.ks添加到wss4j-1.5.8.jar中。我不知道这是不是故意的。我更喜欢将这两个文件都放在这个.jar库中。

编辑:在其他环境下,我尝试使用单独的client.properties,它工作了!现在wss4j-1.5.8.jar是原始的,没有配置和密钥库。我不知道为什么这个能行得通,但之前没能行得通:(

EDIT2:当Eclipse运行应用程序时,它可能不会将项目目录添加到子路径。我放弃了将.properies文件添加到一些.jar中,现在我使用:从菜单选择Run->Debug Configurations,找到您的Java应用程序及其类路径选项卡。然后选择“用户条目”并单击右侧面板中的“高级”按钮,然后选择“添加外部文件夹”。现在添加包含.properties文件的目录。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3280693

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档