启动时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. 几种IO情况的学习和总结 关于 =====阻塞/非阻塞以及同步/异步区别

    同步IO和异步IO,阻塞IO和非阻塞IO分别是什么,到底有什么区别?不同的人在不同的上下文下给出的答案是不同的.所以先限定一下本文的上下文. 背景是Linux环境下的network IO. 在进行解释 ...

  2. 多线程编程_CyclicBarrier

    1.类说明: 一个同步辅助类,它允许一组线程互相等待,直到到达某个公共屏障点 (common barrier point).在涉及一组固定大小的线程的程序中,这些线程必须不时地互相等待,此时 Cycl ...

  3. python 选取Serise、DataFrame列的子集方法

  4. Django重新整理4---ModelForm-set(批量处理数据)

    1. #引用modelformset from django.forms.models import modelformset_factory #必须继承forms.ModelForm! class ...

  5. GOPS 2018全球运维大会上海站 参会感悟梳理

    今天遇到很多优秀的讲师.业界的大伽,很开心 现在把get到的信息梳理一下:(1)想解决性能问题,一定要在缓存上下功夫:[nginx上有好多文章可以做,真是博大精深呢<深入理解Nginx:模块开发 ...

  6. element中遇到的表格问题总结

    1.列表表头的颜色自定义 <el-table :data="pageData" style="width: 100%;" height="500 ...

  7. Asp.Net MVC 5 Razor 视图 未将对象引用到实例

    未将对象引用到实例的错误居然指向了@{Leyout=“..此处略,核实路径无误”}. 最后发现原来是在一个<select .. name="@Model.Category"& ...

  8. 显示器分辨率不同,部分winform控件在其他机器上显示不全

    在开发机器上效果如下: 而到其他电脑上效果如下: 解决办法: 将窗体的AutoScaleMode属性设置为None,尝试一下,应该可以了. 关于AutoScaleMode的属性,可以参考 http:/ ...

  9. Sharepoint2010新建一个用户的方法

    最近在做关于SharePoint的相关开发,在开发中需要用到测试用户进行相关权限的测试,所以就需要创建一个新的用户进行,但是在网上找了很久都没有找到关于创建一个新用户的资料,最后终于在http://w ...

  10. 从零开始的全栈工程师——js篇2.20(事件对象 冒泡与捕获)

    一.复习 面向对象 1)单例模式 2)工厂模式 3)构造函数 ①类js天生自带的类 基类object function array number math boolean date regexp st ...