关于两个jar包中存在包名和类名都完全相同的问题 (...is not applicable for the arguments...)
2016-08-18 17:45
369 查看
最近弄webservice,我使用的jdk自带的wsimport工具来生成客户端代码,发现生成的代码具有编译错误,错误描述如下:
The method getPort(QName, Class<T>) in the type Service is not applicable for the arguments (QName, Class<SCServicePortType>, WebServiceFeature[]).
而我单独创建新的项目来测试生成的客户端代码却没有这样的错误,所以错误原因在于jar包冲突.....
几近周折,终于让我发现,原来javax.xml.ws.Service这个类,即存在于jdk自带的rt.jar中,也存在于我项目引用包jaxws-api.jar(也可能是其他包,我的项目是javaee-api-5.1.0.jar),这种情况就是两个jar包中存在包名和类名都完全相同的问题。我需要的是rt.jar中的javax.xml.ws.Service类,但它却自动引入了jaxws-api.jar的javax.xml.ws.Service类,但是这两个jar包都不能去掉。
所以,只有改变编译器优先选择的jar顺序(这个顺序是可以改变的):包jdk放到前面就好了。
其他类似的也可以用这种方法解决。
原文:http://blog.csdn.net/jayjjb/article/details/7963937
The method getPort(QName, Class<T>) in the type Service is not applicable for the arguments (QName, Class<SCServicePortType>, WebServiceFeature[]).
而我单独创建新的项目来测试生成的客户端代码却没有这样的错误,所以错误原因在于jar包冲突.....
几近周折,终于让我发现,原来javax.xml.ws.Service这个类,即存在于jdk自带的rt.jar中,也存在于我项目引用包jaxws-api.jar(也可能是其他包,我的项目是javaee-api-5.1.0.jar),这种情况就是两个jar包中存在包名和类名都完全相同的问题。我需要的是rt.jar中的javax.xml.ws.Service类,但它却自动引入了jaxws-api.jar的javax.xml.ws.Service类,但是这两个jar包都不能去掉。
所以,只有改变编译器优先选择的jar顺序(这个顺序是可以改变的):包jdk放到前面就好了。
其他类似的也可以用这种方法解决。
原文:http://blog.csdn.net/jayjjb/article/details/7963937
相关文章推荐
- 关于hadoop中The method XXXX is not applicable for the arguments问题的解决
- View is not applicable for the arguments 解决方案
- The method setClass(Context, Class<?>) in the type Intent is not applicable for the问题
- [真理永垂不朽]The method XXX in the type FragmentTransaction is not applicable for the arguments XXX
- 关于The method setMapperClass(Class<? extends Mapper>) in the type Job is not applicable for the argum
- The method setValue(String) in the type ParamTag is not applicable for the arguments (long)
- The method setBackground(Drawable) in the type View is not applicable for the arguments (int)
- The method setStatus(int) in the type Goods is not applicable for the arguments (Integer)
- 错误:The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, MyFragment)
- The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder is not applicable for the arguments
- The method sendKeys(CharSequence[]) in the type WebElement is not applicable for the arguments (String)
- OSCache的源码编译Cache.java 文件报add(Class, T) in the type EventListenerList is not applicable for the arguments 错误的解决
- The method setClass(Context, Class<?>) in the type Intent is not applicable for the arguments (GameV
- The method create(Context, Uri) in the type MediaPlayer is not applicable for the arguments (new Vie
- The method load(Class, Serializable) in the type Session is not applicable for the arguments (Class<
- The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the arguments (int, SettingFragment, String)
- The method setItems(String) in the type ForTokensTag is not applicable for the arguments (Object)
- [SPRING]setCallback(Callback) in the type Enhancer is not applicable for the arguments (CGLibProxy)
- The method add(Fragment) in the type ArrayList<Fragment> is not applicable for the arguments (ImageF
- 关于两个jar包中存在包名和类名都完全相同的jar包冲突问题