我有一个来自供应商的样例命令行Java应用程序,它依赖于SSL身份验证。我拥有供应商的证书,可以在我的Java 7 cacerts文件中看到它们(Windows,c:\ program files \ java \ jdk1.7.0_07 \ jre \ lib \ security \ cacerts)。如果我打开Java 8 cacerts文件,它们就不在那里了(c:\ program files \ java \ jre1.8.0_66 \ lib \ security \ cacerts)。
如果我设置一个路径让Java 8处于首位,则该程序会正常运行。如果我改变路径让Java 7处于首位,则该程序会因证书错误而失败:
这恰恰与我预期的相反——在Java 7文件夹中,是cacerts文件具有供应商证书链,而Java 8则没有。然而,在Java 7上运行该程序会导致认证错误,而在Java 8上运行则成功。
有人能告诉我应该查找什么来解释这个问题吗?
如果我设置一个路径让Java 8处于首位,则该程序会正常运行。如果我改变路径让Java 7处于首位,则该程序会因证书错误而失败:
C:\project\tryCerts\Demo2>path=c:\program files\java\jdk1.7.0_07\bin;c:\program files\java\jre1.8.0_66\bin
C:\project\tryCerts\Demo2>java -jar vendorCmd.jar user1 password2 environment3
Dec 22, 2015 11:11:35 AM [com.sun.xml.ws.policy.jaxws.PolicyConfigParser] parse
INFO: WSP5018: Loaded WSIT configuration from file: jar:file:/C:/project/tryCerts/Demo2/vendorCmd/dist/vendorCmd.jar!/META-INF/wsit-client.xml.
Unable to log in: com.sun.xml.ws.client.ClientTransportException: HTTP transport error: javax.net.ssl.SSLHandshakeException: sun.security.validator.Va
lidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to re
quested target
C:\project\tryCerts\Demo2>path=c:\program files\java\jre1.8.0_66\bin;c:\program files\java\jdk1.7.0_07\bin
C:\project\tryCerts\Demo2>java -jar vendorCmd.jar acc03\acc03_ws_user accwbS3rv!ceS acc03_p_production
Dec 22, 2015 11:21:34 AM [com.sun.xml.ws.policy.jaxws.PolicyConfigParser] parse
INFO: WSP5018: Loaded WSIT configuration from file: jar:file:/C:/project/tryCerts/Demo2/vendorCmd/dist/vendorCmd.jar!/META-INF/wsit-client.xml.
logged in
Dec 22, 2015 11:21:35 AM [com.sun.xml.ws.policy.jaxws.PolicyConfigParser] parse
INFO: WSP5018: Loaded WSIT configuration from file: jar:file:/C:/project/tryCerts/Demo2/vendorCmd/dist/vendorCmd.jar!/META-INF/wsit-client.xml.
Signed Info:org.jcp.xml.dsig.internal.dom.DOMSignedInfo@3f071328
AccountNumber: 279105/ Firstname: null/ LastName: null
AccountNumber: 1005118/ Firstname: null/ LastName: COMPANY1
AccountNumber: 2102765/ Firstname: null/ LastName: COMPANY2
AccountNumber: 2101373/ Firstname: null/ LastName: COMPANY3
AccountNumber: 2119664/ Firstname: null/ LastName: COMPANY4
AccountNumber: 2119668/ Firstname: null/ LastName: ET CETERA
C:\project\tryCerts\Demo2>dir/s cacerts
Volume in drive C is OS
Volume Serial Number is 9896-211D
File Not Found
C:\project\tryCerts\Demo2>
这恰恰与我预期的相反——在Java 7文件夹中,是cacerts文件具有供应商证书链,而Java 8则没有。然而,在Java 7上运行该程序会导致认证错误,而在Java 8上运行则成功。
有人能告诉我应该查找什么来解释这个问题吗?