启动时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. python_字典 学习

    一.创建字典(关联数组或hash表) 字典由键(key)和对应的值(values)组成. 代码: dic = { ‘ name‘:1 , ‘ zhang ’:2 , ‘ age‘ :3 , ‘ sex ...

  2. chrome 修改请求头的小工具

    chrome 网上应用店中搜索  ModHeader

  3. PHP文件上传error的错误类型 - $_FILES['file']['error']

    假设文件上传字段的名称img,则: $_FILES['img']['error']有以下几种类型 1.UPLOAD_ERR_OK 其值为 0,没有错误发生,文件上传成功. 2.UPLOAD_ERR_I ...

  4. CentOS 7 Linux 卸载/安装 Mariadb MySQL mysql 5.7

    [root@localhost mysql]# ls mysql-community-client--.el7.x86_64.rpm mysql-community-embedded-compat-- ...

  5. ssh RSA key变化后处理

    root@localhost:/# scp -r root@172.19.47.30:/home/linux-4.16.2-devm.1.2.aarch64.dongbo ./@@@@@@@@@@@@ ...

  6. Kudu的架构

    不多说,直接上干货!  Kudu的架构 1.kudu的 基本框架 Kudu 是用于存储结构化( structured )的表( Table ).表有预定义的带类型的列( Columns ),每张表有一 ...

  7. [PHP]Mysql的运用

    1.创建数据库和表,代码如下: //创建数据库函数 function createDB($DBname){ $query="CREATE DATABASE $DBname"; re ...

  8. 当post 的字段很多,post的字段并不完全修改(有的值是前端input的值,有的任保留原来原来数据库的值),

    有一种解决方法(ps:from ljq):  把数据库的值先全部遍历出来,然后再对遍历出来值的$key进行一个判断, example: foreach ($results[0] as $key =&g ...

  9. Gradient Boosting算法简介

    最近项目中涉及基于Gradient Boosting Regression 算法拟合时间序列曲线的内容,利用python机器学习包 scikit-learn 中的GradientBoostingReg ...

  10. java学习第十四天

    1:正则表达式(理解) (1)就是符合一定规则的字符串 (2)常见规则 A:字符 x 字符 x.举例:'a'表示字符a \\ 反斜线字符. \n 新行(换行)符 ('\u000A') \r 回车符 ( ...