java 导入 com.sun.xml.internal.ws.client.ClientTransportException,无法读取此导入

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13632398/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 13:26:56  来源:igfitidea点击:

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

javaimportjaxb

提问by Jorge Rocha

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

我无法解决这个问题,我尝试导入 com.sun.xml.internal.ws.client.ClientTransportException但我无法导入它。

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)

回答by Charlie Collins

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

有关更多详细信息,以及临时覆盖丢失的导入以进行测试,或者如果您有特殊要求,请参阅此类似问题: com.sun.xml.internal.ws.client 不存在

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

但实际上,您将希望使用 API 的公开可用部分,而不是内部的。

回答by Vibhath

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

您应该检查 WSDL url 是否有效 这意味着,在 Web 服务客户端类中。见上面的代码。

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

在上面的代码中,检查 WSDL url 是否有效,或者检查 WSDL 是否已经托管在该 url 中。如果您的 wsdl 文件在您的本地电脑中,请检查它是否像下图一样运行您可以在测试网络服务时在浏览器中看到 wsdl url

enter image description here

在此处输入图片说明

回答by Fakhar uddin Malik

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

为此,您可以使用jaxws-rt.jar。jre 系统库中的 rt.jar 会限制编译器访问它的一些包。