无法为Exchange EWS生成代理类:无法找到所请求目标的有效证书路径

时间:2011-01-18 10:13:43

标签: java exchangewebservices keytool wsimport truststore

我想为EWS生成代理类(http://msdn.microsoft.com/en-us/library/dd877045%28v=exchg.140%29.aspx)。

keytool -keystore t:\my.keystore -storepass password -import -trustcacerts -alias MY-CA -file t:\MY-CA.crt
keytool -keystore t:\my.keystore -storepass password -list
set VMARGS=-Djavax.net.debug=all
set VMARGS=%VMARGS% -Djavax.net.ssl.trustStore=t:\my.keystore -Djavax.net.ssl.trustStorePassword=password
wsimport https://mail.xxxx.co.jp/ews/Exchange.asmx

但我收到此错误消息:

[ERROR]
sun.security.validator.ValidatorException:
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target

2 个答案:

答案 0 :(得分:0)

尝试:

wsimport -Djavax.net.ssl.trustStore=t:\my.keystore https://mail.xxxx.co.jp/ews/Exchange.asmx

看起来wsimport没有接收到VMARGS。

如果以上工作,则证明确凿。否则,问题是您的密钥库中添加了错误的RootCA或者未读取密钥库

答案 1 :(得分:0)

我可以确认这仍然是JDK1.6.0u29的问题

运行以下命令时:

wsimport -Djavax.net.ssl.trustStore=c:\jdk160_29\.mykeystore https://url.com?wsdl -p com.test -s ./src

我收到以下错误:

unrecognized parameter -Djavax.net.ssl.trustStore=c:\jdk160_29\.mykeystore

但是我找到了一个解决方法来执行以下命令:

java -Djavax.net.ssl.trustStore=c:\jdk160_29\.mykeystore -classpath C:\jdk160_29\lib\tools.jar com.sun.tools.internal.ws.WsImport https://ur.com?wsdl -p com.test -s ./src