简体   繁体   English

编译时找不到com.sun.xml.internal.ws.developer.JAXWSProperties

[英]com.sun.xml.internal.ws.developer.JAXWSProperties not found at compile

We used the class JAXWSProperties from the com.sun.* package in the code in order to set timeout properties like this: 我们在代码中使用com.sun.*包中的类JAXWSProperties来设置超时属性,如下所示:

import com.sun.xml.internal.ws.developer.JAXWSProperties;
...
Map<String, Object> ctxt = ((BindingProvider) port).getRequestContext();
ctxt.put(JAXWSProperties.CONNECT_TIMEOUT, 10000);

It compiles fine in the local Eclipse, but not on a continuous integration system (both using JDK 1.6). 它在本地Eclipse中编译良好,但不在连续集成系统上编译(两者都使用JDK 1.6)。 From researching this problem, I learned that the com.sun.* package should be avoided. 通过研究这个问题,我了解到应该避免使用com.sun.*包。

So my questions are: 所以我的问题是:

  • What causes the failed import at compile time? 导致编译时导入失败的原因是什么?
  • What should be used instead of JAXWSProperties ? 应该使用什么代替JAXWSProperties

I've just had pretty much the same problem while converting one of our projects to run under Maven. 在将我们的一个项目转换为在Maven下运行时,我遇到了同样的问题。

The solution I found, isn't really an ideal solution, in fact it's more of a "cludge" than a "fix," although it does run through the compiler OK. 我发现的解决方案并不是一个理想的解决方案,实际上它更像是一个“cludge”而不是“fix”,尽管它确实可以通过编译器运行。 Like you I did a bit of research on this issue, and found a comment from Sun saying that these packages are hidden from the compiler, but are available to the JVM. 和你一样,我对这个问题进行了一些研究,并发现Sun的评论说这些软件包对编译器是隐藏的,但可供JVM使用。

So, the solution I found was to simply find the string to which the constant was pointing, and use that locally. 因此,我发现的解决方案是简单地找到常量指向的字符串,并在本地使用它。

In your case it would be: 在你的情况下,它将是:

final static String CONNECT_TIMEOUT = "com.sun.xml.internal.ws.connect.timeout";
....
Map<String, Object> ctxt = ((BindingProvider) port).getRequestContext();
ctxt.put(CONNECT_TIMEOUT, 10000);

As I mentioned, this isn't ideal, and can not be guaranteed to work in future compiler releases, so use with care. 正如我所提到的,这并不理想,并且无法保证在将来的编译器版本中工作,因此请谨慎使用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用JAX-WS请求ws时抛出com.sun.xml.internal.ws.protocol.soap.VersionMismatchException - com.sun.xml.internal.ws.protocol.soap.VersionMismatchException thrown when using JAX-WS to request a ws 获取 java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl 尽管定义了依赖项 - Getting java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl despite the dependencies are defined 接口com.sun.xml.ws.developer.WSBindingProvider在类加载器中不可见 - interface com.sun.xml.ws.developer.WSBindingProvider is not visible from class loader jaxws-rt.jar中的“ / com / sun / xml / ws /”软件包和rt.jar中的“ / com / sun / xml / internal / ws /”软件包之间有什么区别 - what is the Difference between the “/com/sun/xml/ws/” package in jaxws-rt.jar and “/com/sun/xml/internal/ws/” package inside rt.jar 无法初始化 class com.sun.xml.internal.ws.fault.SOAPFaultBuilder - Could not initialize class com.sun.xml.internal.ws.fault.SOAPFaultBuilder 在 Jenkins 上构建失败:错误:package com.sun.Z0F635D0E0F3874FFF8B581C1.ws.不存在。 - Build on Jenkins fails: error: package com.sun.xml.internal.ws.client does not exist JAX WS com.sun.xml.internal.ws.client.ClientTransportException:HTTP 传输错误:java.net.ConnectException:连接被拒绝 - JAX WS com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: java.net.ConnectException: Connection refused Glassfish抛出com.sun.xml.ws.client.ClientTransportException:服务器发送了HTTP状态代码500:内部服务器错误 - Glassfish throws com.sun.xml.ws.client.ClientTransportException: The server sent HTTP status code 500: Internal Server Error com.sun.xml.ws.message.saaj.SAAJHeader无法强制转换为com.sun.xml.ws.security.opt.impl.outgoing.SecurityHeader - com.sun.xml.ws.message.saaj.SAAJHeader cannot be cast to com.sun.xml.ws.security.opt.impl.outgoing.SecurityHeader 连接到 web 服务导致 com.sun.xml.internal.ws.client.ClientTransportException:服务器发送 HTTP 状态码 200 - Connecting to webservice results in com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 200: OK
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM