简体   繁体   中英

import com.sun.xml.internal.ws.client.ClientTransportException, can't read this import

I can't resolve this problem, i try to do import com.sun.xml.internal.ws.client.ClientTransportException but i can't import it.

Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 404: Not Found

at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:296)

at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:245)

at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.j
ava:203)

at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:122)

at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95)

at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626)

at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585)

at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570)

at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467)   

at com.sun.xml.internal.ws.client.Stub.process(Stub.java:308)

at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:146)

at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98)

at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)

at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:129)

You shouldn't try to import the "internal" package. It's not available by design.

See this similar question for more details, and a way to override the missing import temporarily for testing, or if you have special requirements: com.sun.xml.internal.ws.client does not exist

Really though, you'll want to use the publicly available parts of the API, not the internal.

You should check WSDL url is a valid or not It means, in Web service client class. see above code.

static {
    URL url = null;
    WebServiceException e = null;
    try {
        url = new 
        URL("http://localhost:8084/SoapServer_test_4/CustomerService?wsdl");
    } catch (MalformedURLException ex) {
        e = new WebServiceException(ex);
    }
    CUSTOMERSERVICE_WSDL_LOCATION = url;
    CUSTOMERSERVICE_EXCEPTION = e;
}

in above code, check the WSDL url is a valid or not, or check WSDL is already hosted in that url. if your wsdl file is in your local pc, check it run like below image you can see the wsdl url in your browser like this when you test the webservice

在此处输入图片说明

You can use jaxws-rt.jar for this purpose. rt.jar in jre system library will restrict compiler to access some of its packages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM