我使用wsdl2java生成代码,并成功创建Web服务客户端以调用服务。 但是当我将我的程序放到服务器机器上时,该程序无法创建Web服务客户端。如果该机器可以访问互联网,一切正常。所以我认为这个例外是由于cxf无法访问http://schemas.xmlsoap.org/soap/encoding/
堆栈跟踪:
14-11-20 18:51:20 create WSUtil err: [main-com.jadic.ws.WSUtil]
javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:151) ~[cxf-rt-frontend-jaxws-2.7.12.jar:2.7.12]
at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:101) ~[cxf-rt-frontend-jaxws-2.7.12.jar:2.7.12]
at javax.xml.ws.Service.<init>(Unknown Source) ~[na:1.6.0_05]
at com.jadic.ws.czsmk.CenterProcess.<init>(CenterProcess.java:43) ~[stserver-1.0.0.jar:na]
at com.jadic.ws.WSUtil.createServiceClient(WSUtil.java:106) [stserver-1.0.0.jar:na]
at com.jadic.ws.WSUtil.<init>(WSUtil.java:95) [stserver-1.0.0.jar:na]
at com.jadic.ws.WSUtil.getWsUtil(WSUtil.java:76) [stserver-1.0.0.jar:na]
at com.jadic.STServer.<init>(STServer.java:34) [stserver-1.0.0.jar:na]
at com.jadic.STServer.main(STServer.java:57) [stserver-1.0.0.jar:na]
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:100) ~[cxf-rt-core-2.7.12.jar:2.7.12]
at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:204) ~[cxf-rt-frontend-jaxws-2.7.12.jar:2.7.12]
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:149) ~[cxf-rt-frontend-jaxws-2.7.12.jar:2.7.12]
... 8 common frames omitted
Caused by: javax.wsdl.WSDLException: WSDLException (at /definitions/types/schema): faultCode=PARSER_ERROR: Problem parsing 'http://schemas.xmlsoap.org/soap/encoding/'.: java.net.UnknownHostException: schemas.xmlsoap.org
at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2198) ~[wsdl4j-1.6.3.jar:1.6.3]
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(WSDLReaderImpl.java:830) ~[wsdl4j-1.6.3.jar:1.6.3]
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(WSDLReaderImpl.java:654) ~[wsdl4j-1.6.3.jar:1.6.3]
at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(WSDLReaderImpl.java:610) ~[wsdl4j-1.6.3.jar:1.6.3]
at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(WSDLReaderImpl.java:320) ~[wsdl4j-1.6.3.jar:1.6.3]
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2352) ~[wsdl4j-1.6.3.jar:1.6.3]
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2338) ~[wsdl4j-1.6.3.jar:1.6.3]
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:261) ~[cxf-rt-core-2.7.12.jar:2.7.12]
at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:206) ~[cxf-rt-core-2.7.12.jar:2.7.12]
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:98) ~[cxf-rt-core-2.7.12.jar:2.7.12]
... 10 common frames omitted
Caused by: java.net.UnknownHostException: schemas.xmlsoap.org
at java.net.PlainSocketImpl.connect(Unknown Source) ~[na:1.6.0_05]
at java.net.Socket.connect(Unknown Source) ~[na:1.6.0_05]
at java.net.Socket.connect(Unknown Source) ~[na:1.6.0_05]
at sun.net.NetworkClient.doConnect(Unknown Source) ~[na:1.6.0_05]
at sun.net.www.http.HttpClient.openServer(Unknown Source) ~[na:1.6.0_05]
at sun.net.www.http.HttpClient.openServer(Unknown Source) ~[na:1.6.0_05]
at sun.net.www.http.HttpClient.<init>(Unknown Source) ~[na:1.6.0_05]
at sun.net.www.http.HttpClient.New(Unknown Source) ~[na:1.6.0_05]
at sun.net.www.http.HttpClient.New(Unknown Source) ~[na:1.6.0_05]
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) ~[na:1.6.0_05]
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) ~[na:1.6.0_05]
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) ~[na:1.6.0_05]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) ~[na:1.6.0_05]
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) ~[na:1.6.0_05]
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(Unknown Source) ~[na:1.6.0_05]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) ~[na:1.6.0_05]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) ~[na:1.6.0_05]
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) ~[na:1.6.0_05]
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source) ~[na:1.6.0_05]
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source) ~[na:1.6.0_05]
at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2188) ~[wsdl4j-1.6.3.jar:1.6.3]
... 19 common frames omitted
所以你能告诉我如何解决这个问题,谢谢你的帮助
答案 0 :(得分:0)
删除所有与cxf相关的jar,有效。
因为我没有在我的代码中使用cxf库,只需使用cxf工具生成存根类
答案 1 :(得分:0)
尝试在类路径中配置saaj(saaj-impl-1.3.2.jar)..