CXF error [1 counts of illegalannotationexceptions]and[two classes has the same XML type Name]and[use @XmlType. Name and @XmlTy Pe.namespace to assign different names to them]

Source: Internet
Author: User

The CXF error at startup is as follows:

caused by:com.sun.xml.bind.v2.runtime.illegalannotationsexception:1 counts of Illegalannotationexceptionstwo Classes has 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 was 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 are related to the    following location: at        Com.shengpay.masopen.facade.service.jaxws _asm. Verifyresponse

The hints are clear:

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

There are two class names =verifyresponse XML type name

The processing scheme given is

Use @XmlType. Name and @XmlType. Namespace to assign different names to them.

Use @xmltype's name and namespace to make a distinction

Originally, WebService at the time of release: to WebService inside each method generates a class, the generated class name is: methodName + "Response",所以就回导致生成的类和原来的类有两个相同的xml type。

See Interface definition:

@WebService  Public Interface Realnameverifyservice {    /**     *     Real-name authentication processing ... @param Request      @return     */ Throws Businessexception ;}          

The method name is verify, the return value is Verifyresponse, and Webswevice will generate a class verifyresponse for my method, which is a conflict.

There are two commonly used solutions:

1. Modify the Return object name and no longer use the Verifyresponse class name

2. Use @webmethod to specify the generated class name

@WebService  Public Interface Realnameverifyservice {    /**     *     Real-name authentication processing ... @param Request      @return     */     @WebMethod (OperationName= "wsverify")    throws  businessexception;}

Reference:

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

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

CXF error [1 counts of illegalannotationexceptions]and[two classes has the same XML type Name]and[use @XmlType. Name and @XmlTy Pe.namespace to assign different names to them]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.