启动时CXF报错如下:

Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "{http://service.facade.masopen.shengpay.com/}verifyResponse". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at com.shengpay.masopen.facade.model.verify.VerifyResponse
at private com.shengpay.masopen.facade.model.verify.VerifyResponse com.shengpay.masopen.facade.service.jaxws_asm.VerifyResponse._return
at com.shengpay.masopen.facade.service.jaxws_asm.VerifyResponse
this problem is related to the following location:
at com.shengpay.masopen.facade.service.jaxws_asm.VerifyResponse

提示很明确:

Two classes have the same XML type name "{http://service.facade.masopen.shengpay.com/}verifyResponse"

存在两个类名=verifyResponse的xml type name

给出的处理方案是

Use @XmlType.name and @XmlType.namespace to assign different names to them.

使用@xmlType的name和namespace做区分

原来,WebService在发布的时候:对webservice里面得每个方法都生成一个类,生成的类名为: methodName + "Response",所以就回导致生成的类和原来的类有两个相同的xml type。

请看接口定义:

@WebService
public interface RealNameVerifyService {
/**
* 实名认证处理...
* @param request
* @return
*/ VerifyResponse verify(VerifyRequest request) throws BusinessException;
}

方法名是verify,返回值是VerifyResponse,而webSwevice也会为我的方法生成一个类verifyResponse,这就冲突了。

解决方案常用有两个:

1.修改返回对象名称,不再使用VerifyResponse类名

2.使用@WebMethod指定生成的类名

@WebService
public interface RealNameVerifyService {
/**
* 实名认证处理...
* @param request
* @return
*/
@WebMethod(operationName="wsVerify")
VerifyResponse verify(VerifyRequest request) throws BusinessException;
}

参考:

http://stackoverflow.com/questions/4254334/illegalannotationexception-two-classes-have-the-same-xml-type-name

http://asialee.iteye.com/blog/1913480

CXF报错[1 counts of IllegalAnnotationExceptions]and[Two classes have the same XML type name]and[Use @XmlType.name and @XmlType.namespace to assign different names to them]的更多相关文章

  1. weblogic 整合cxf 报错:cannot create a secure XmlInputFactory

    weblogic 整合cxf 报错:cannot create a secure XmlInputFactory ================================ ©Copyright ...

  2. 关于SpringMVC项目报错:java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/xxxx.xml]

    关于SpringMVC项目报错:java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/xxxx ...

  3. SpringCloud报错: "Field discoveryClient in com.controller.DcController required a bean of type 'com.netflix.discovery.DiscoveryClient' that could not be found."

    SpringCloud报错: "Field discoveryClient in com.controller.DcController required a bean of type 'c ...

  4. 【Webservice】2 counts of IllegalAnnotationExceptions Two classes have the same XML type name

    在使用客户端调用服务端的时候发生了2 counts of IllegalAnnotationExceptions Two classes have the same XML type name的错误, ...

  5. cxf报错 Cannot find any registered HttpDestinationFactory from the Bus.

    错误信息:Cannot find any registered HttpDestinationFactory from the Bus. 报错主要是因为缺少jetty依赖 一般添加如下依赖即可 < ...

  6. eclipse 运行 mapreduce程序报错 No job jar file set. User classes may not be found. See JobConf(Class) or JobConf#setJar(String).

    报错信息 17/07/06 17:00:27 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Ap ...

  7. 2. springboot启动报错:Field userMapper in com.service.UserService required a bean of type 'com.dao.UserMapper' that could not be found.

    报错信息: 2018-06-25 14:26:17.103  WARN 49752 --- [  restartedMain] ationConfigEmbeddedWebApplicationCon ...

  8. java 反射 报错:Attempt to get java.lang.Integer field "..." with illegal data type conversion to int

    类: Integer id; 反射时: Field f = User.class.getDeclaredField("id"); f.setAccessible(true); in ...

  9. 报错分析---->jsp自定义标签:类cannot be resolved to a type

    这个困扰我一个晚上,仔细上网查阅发现,主要是因为jsp自定义标签要用到的这个jsp-api.jar的问题 这是我eclipes中的jar: 然而jsp-api.jar这个jar在tomcat中也有(报 ...

随机推荐

  1. IDEA修改git账号及密码的方法

    IDEA修改git账号及密码的方法: 1.file->settings->passwords 2.重启IDEA 3.执行一次提交或更新 当执行提交或更新之后,idea会自动提示输入账号.密 ...

  2. Vue 参数传递及刷新后依旧存在

    获取参数方式有两种: 1.params2.query 第一种方式: params this.$router.push({name:'Hello',params:{name:'zs',age:'22'} ...

  3. [转]显示农历日期的JS

    本文转自:http://blog.sina.com.cn/s/blog_47377e77010009xc.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD ...

  4. 转:Android开源项目推荐之「网络请求哪家强」 Android开源项目推荐之「网络请求哪家强」

    转载自https://zhuanlan.zhihu.com/p/21879931 1. 原则 本篇说的网络请求专指 http 请求,在选择一个框架之前,我个人有个习惯,就是我喜欢选择专注的库,其实在软 ...

  5. Java异常处理学习

    今天才开通了博客园的博客,希望可以记录自己学习的点点滴滴.最近去处理了一些私人事情,有点烦人,希望自己不要被这些破事所影响. 最近在看马士兵老师的Java基础的视频,(中断了一周)发现本科时候的胡老师 ...

  6. hduoj 2602Bone Collector

    Bone Collector Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)To ...

  7. ASP.NET那点不为人知的事(一)

    http://www.cnblogs.com/OceanEyes/archive/2012/08/13/aspnetEssential-1.html#_label0 我们上网时,在浏览器地址输入网址: ...

  8. html和Url转码与解码

    JS (JQuery)对Html.URL的编码与解码 首先引入JQuery文件 1.js对Html编码 function htmlEncode(value){ return $('<div/&g ...

  9. 《Google软件测试之道》之学习笔记01

    Google软件测试介绍 软件测试团队->工程生产力(Engineering Productivity) http://googletesting.blogspot.com/2011/01/ho ...

  10. Python数据类型及常用操作

    Python字符串类型 1.用途: 用来记录有描述性的状态.比如:人名,地址等. 2.定义方式: 创建字符串非常简单,在‘ ’,“ ”,‘’‘ ’‘’内一填写一系列的字符例如:msg='hello' ...