CXF报错[1 counts of IllegalAnnotationExceptions]and[Two classes have the same XML type name]and[Use @X
Posted 花花牛
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CXF报错[1 counts of IllegalAnnotationExceptions]and[Two classes have the same XML type name]and[Use @X相关的知识,希望对你有一定的参考价值。
启动时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 @X的主要内容,如果未能解决你的问题,请参考以下文章
sql报错Illegal mix of collations
sql报错Illegal mix of collations
mysql union语句报错:Error Code: 1271. Illegal mix of collations for operation ‘UNION‘
报错:illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation
报错c(179) : error C2275: 'LNODE' : illegal use of this type as an expression等,哪里错了,怎么改呢
Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included