[英]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: 所以我的问题是:
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.