com.sun.xml.internal.ws.client不存在 [英] com.sun.xml.internal.ws.client does not exist

查看:2888
本文介绍了com.sun.xml.internal.ws.client不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试捕获ClientTransportException并且我的程序在编译阶段失败并出现以下异常

I'm trying to catch ClientTransportException and my program fails on compilation stage with the following exception

[ERROR]\workspace\rates\java\service\bundle1\src\main\java\com\connector\ws\TestClass1.java:[72,70] package com.sun.xml.internal.ws.client does not exist

我知道这个包是来自rt.jar并且存在于jre中

As I know this package is from rt.jar and exist in jre

如果我添加@SuppressWarnings(restriction),它将从Eclipse Maven插件编译,但不能从IntelliJ Idea(通过maven)或命令行编译。

If I add @SuppressWarnings("restriction") it compiles from Eclipse Maven Plugin, but not from IntelliJ Idea(via maven) or command line neither.

当我删除@SuppressWarnings时,Eclipse显示以下警告

When I remove @SuppressWarnings Eclipse show the following warning

Access restriction: The type ClientTransportException is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar

我发现类似的问题,但它的答案对我来说不够清楚,因为我可以在rt.jar中使用这个类,我的IntelliJ Idea也可以看到它。

I've found similar question but it's answer isn't clear enough for me cause I can this class in rt.jar and my IntelliJ Idea can see it either.

有人可以解释这种行为及其可能的解决方案吗?

Can someone explain such behavior and possible solution for it?

推荐答案

根据这个常见问题解答,这是一个不好的做法直接叫'太阳'包。当我遇到同样的问题时,它通过捕获 javax.xml.ws.WebServiceException 来修复(由artbristol吸收)。

According to this FAQ it's a bad practice to directly call 'sun' packages. When I ran into the same problem it was fixed by catching javax.xml.ws.WebServiceException instead (as sugested by artbristol).

这篇关于com.sun.xml.internal.ws.client不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆