2013-06-27 190 views
1

使用Apache Axis2中包含的WSDL2Java.bat從聯機SOAP WSDL服務生成.java文件,但是我收到有關某個證書的錯誤。我不知道這是從哪裏來的,它應該按照我給的指示工作。WSDL2Java證書錯誤

Using AXIS2_HOME: C:\Users\****\Downloads\axis2-1.6.2-bin\axis2-1.6.2 
Using JAVA_HOME: C:\Program Files\Java\jre7 
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException 
: Error parsing WSDL 
     at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerat 
ionEngine.java:181) 
     at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) 
     at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) 
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.Validator 
Exception: PKIX path building failed: sun.security.provider.certpath.SunCertPath 
BuilderException: unable to find valid certification path to requested target 
     at sun.security.ssl.Alerts.getSSLException(Unknown Source) 
     at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source) 
     at sun.security.ssl.Handshaker.fatalSE(Unknown Source) 
     at sun.security.ssl.Handshaker.fatalSE(Unknown Source) 
     at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source) 
     at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) 
     at sun.security.ssl.Handshaker.processLoop(Unknown Source) 
     at sun.security.ssl.Handshaker.process_record(Unknown Source) 
     at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) 
     at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source 
) 
     at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) 
     at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) 
     at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) 
     at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect 
(Unknown Source) 
     at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown So 
urce) 
     at java.net.HttpURLConnection.getResponseCode(Unknown Source) 
     at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unk 
nown Source) 
     at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerat 
ionEngine.java:99) 
     ... 2 more 
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: unable to find vali 
d certification path to requested target 
     at sun.security.validator.PKIXValidator.doBuild(Unknown Source) 
     at sun.security.validator.PKIXValidator.engineValidate(Unknown Source) 
     at sun.security.validator.Validator.validate(Unknown Source) 
     at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source) 
     at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source) 
     at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Sour 
ce) 
     ... 16 more 
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to 
find valid certification path to requested target 
     at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown 
Source) 
     at java.security.cert.CertPathBuilder.build(Unknown Source) 
     ... 22 more 

任何人有什麼問題可以是任何提示或我應該在哪裏開始尋找?

感謝

回答

3

似乎您試圖生成使用WSDL從HTTPS URL的Java類。它在嘗試驗證證書時失敗。

嘗試從瀏覽器訪問WSDL,它應該給你一個警告。

您可以將WSDL保存到本地目錄,並嘗試爲該文件運行WSDL2Java。

但是,當您通過存根訪問Web服務時,如果端點也是HTTPS URL,您可能會遇到類似錯誤。

+1

謝謝,是的,我通過將它手動保存到.wsdl文件來工作。不過,我還設法通過添加正確的證書,運行「set JAVA_OPTS = -Djavax.net.ssl.trustStore = C:/ Path/to/certificate」,然後從HTTPS源生成Java文件。 –

+0

太棒了!我很高興你能解決這個問題! –