引起:java.io.IOException:HTTPS主机名错误:应该是<www.example.com>

时间:2016-09-27 06:53:45

标签: java https wsdl

我正在尝试使用位于https://www.example.com:5242/calculator/calculatorport?wsdl的java应用程序访问WSDL,但得到上面提到的错误。但是当我在浏览器中输入相同的URL时,我能够访问WSDL。

完整的堆栈跟踪如下: -

javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://www.example.com:5242/calculator/calculatorport?wsdl. It failed with:
        HTTPS hostname wrong:  should be <www.example.com>.
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:163)
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:145)
        at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:267)
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:230)
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:178)
        at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:93)
        at javax.xml.ws.Service.<init>(Service.java:67)
        at com.webservices.calculator.CalculatorService.<init>(CalculatorService.java:46)
        at com.testcl.Transfer.calculate(Transfer.java:118)
        at com.testcl.Transfer.run(Transfer.java:213)
        at java.lang.Thread.run(Thread.java:738)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:908)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:931)
        at java.lang.Thread.run(Thread.java:738)
Caused by: java.io.IOException: HTTPS hostname wrong:  should be <www.example.com>
        at com.ibm.net.ssl.www2.protocol.https.c.b(c.java:69)
        at com.ibm.net.ssl.www2.protocol.https.c.afterConnect(c.java:148)
        at com.ibm.net.ssl.www2.protocol.https.d.connect(d.java:12)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1207)
        at com.ibm.net.ssl.www2.protocol.https.b.getInputStream(b.java:32)
        at java.net.URL.openStream(URL.java:1022)
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:805)
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:263)
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:130)

可能是什么问题,任何帮助都会受到赞赏。

修改 在我的案例中,类似问题中提到的解决方案无效,因为颁发的证书仅为CN www.example.com

0 个答案:

没有答案