javax.xml.ws.WebServiceException: Failed to access the WSDL at: http://127.0.0.1/MsgCenter/MailServicePort?wsdl. It failed with: http://127.0.0.1/MsgCenter/MailServicePort?wsdl. at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:162) at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:144) at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:263) at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:226) at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:174) at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:104) at javax.xml.ws.Service.<init>(Service.java:56) at mailclient.MailService.<init>(MailService.java:54) at mailclient.MailClient.sendMailListIm(MailClient.java:26) at test.TestMain.testMainSend(TestMain.java:71) at test.TestMain.main(TestMain.java:26) Caused by: java.io.FileNotFoundException: http://127.0.0.1/MsgCenter/MailServicePort?wsdl at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1303) at java.net.URL.openStream(URL.java:1009) at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:805) at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:262) at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:129) ... 9 more
原因是由于地址http://127.0.0.1/MsgCenter/MailServicePort?wsdl不存在,将其更换成:
http://localhost:8055/MsgCenter/MailServicePort?wsdl。因为项目中所使用的正是端口为8055,全局搜索替换。