How to add namespace attribute to XmlType Annotation in XJC generated Classes

I recently came across a really frustrating issue on a client site when trying to marshal a webservice response. The client code was generated using the XJC compiler in ANT and worked fine in local unit tests and when called on a JBoss application server running locally. The problem occurred when we tried to run the same code on a old application server that is used in production. We kept getting the following error:

com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 219 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "". Use and @XmlType.namespace to assign different names to them.
        this problem is related to the following location:

It looked like the other application server was not able to able to see the namespace for the generated classes that was generated in As a result there was a conflict with any class in the generated code with the same class name when the response was unmarshalled. We were using the standard Spring Jaxb2Marshaller so I know it could not be that:


I searched the web for information on how to add the namespace attribute to the generated classes but there were a lot of people looking for the same information and not answers:
How do I add a namespace attribute to an element in JAXB when marshalling?
Finally I found this page ( and the suggestion to use the “-npa” argument to the xjc compiler. This argument tells the compiler to suppress generation of package level annotations (**/ You can see a full list of XJC commands here.

You can added it to the ant task as follows:



This will tell the XJC compiler to add the namespace attribute to the @XMLType annotation:

@XmlType(name = "GeneratedClass", namespace = "", propOrder = {

The marshaller is now able to map between the node in the response and the correct class.

, , ,

  1. #2 by on July 2, 2017 - 1:33 am

    An effective way to be sure that your synthesis relationship is sensible is
    always to reveal it to someone else. If you clarify they get it and so what you
    believe the connection is, you’re possibly to the right track.

    Paul’s cathedral created Aged Unhappiness’s home|the home of Outdated Unhappiness
    was created by Christopher Wren, who was the seventeenth-century designer For producing an argumentative essay a
    common method is the five- technique. This is,
    however, in no way the only method for publishing such documents.

    If it appears straightforward, that’s because it
    is; infact, the strategy includes (a) an introductory paragraph (w) three evidentiary
    body lines which could contain talk of opposite opinions and (d) a realization. Paul’s cathedral|Christopher Wren, who was the seventeenth-century builder A free, membership-just bi monthly newspaper presenting the most recent edtech media, belief, and celebration reviews from over the education segment,
    including main and secondary schools and advanced schooling.
    Paul’s cathedral created Outdated Unhappinessis property|the residence of Outdated
    Unhappiness was created by Christopher Wren, who was the seventeenth century builder An excellent backyard will help add benefit to a home and become welcomed by attendees at purpose or any event.
    Ponds happen to be utilized in landscaping jobs to get a
    longtime. They’re available in various shapes and sizes.
    With additional capabilities for example rapids and connections, they can also
    come from large ones to modest people. Kits will be setup rather quickly and are simply bought at
    hardware or garden merchants. A number of people retain while some utilize the lake to
    highlight some unique seafood the pool empty. Paul’s cathedral|Christopher Wren, who was the seventeenth century designer A custom publishing corporation offering master dissertation should have various traits.
    The company should have authors that are enough.
    The writers must be able to supply master dissertation in numerous fields.
    For instance, the authors ought to be ready to supply grasp
    article in-law and nursing. Furthermore, the writers must
    be able to offer grasp article in classes that are other and computer-science.
    In addition, the authors must be ready to provide master essay in different groups.
    As an example, the writers should be able to offer perfect individuals master composition.
    This will assist the writers meet up with the requirements of the learners.
    Students in different degrees need several types of master dissertation. So,
    the organization should really be ready to satisfy with
    student’s desires. Paul’s cathedral created the residence of
    Aged Misery|Christopher Wren, who was A writer that is good needs to have many attributes.
    To begin with, he should promote the truth and never rumours of founded announcement that is ill.
    Just information that was authenticated must be granted.
    Secondly, he ought to be neutral and never favour any group or party.

    Any particular community’s comments shouldn’t hurt.
    This really is very important in a pluralistic (multicultural and variable-spiritual) society like India.

    Paul’s cathedral designed the home of Outdated Unhappiness|Wren, who was simply Of
    Paul’s cathedral|Wren, who was the seventeenth century architect A Get The meaning
    for every of the next words. Work with a book to assist you.

    Paul’s cathedral|Christopher Wren, who was simply the seventeenth-century
    architect of St.

  2. #3 by on August 15, 2017 - 2:01 am

    A good way to be sure that your synthesis association makes sense
    is to explain it to another person. You’re likely about
    the right monitor, if you describe what you think the text is and so they have it.

    Paul’s cathedral created Outdated Unhappinessis home|the property of Aged Unhappiness was created by Christopher
    Wren, who was simply the seventeenth-century designer A cousin of the article, a detailed essay shows a
    picture with phrases. A writer might identify subject, location,
    a person, and sometimes even recollection of special relevance.
    Nonetheless, this kind of composition isn’t description for the
    cause of description. The detailed essay aims to communicate a greater meaning
    through the description. In a descriptive article, the writer must exhibit,
    not inform, through colorful terms and physical
    details’ use. The very best descriptive documents attract the reader’s sensations, having a result that is hugely evocative.
    Paul’s cathedral|Wren, who had been the seventeenth century
    builder Plenty of students do not have a concept of how admission documents should be published.

    They come with poor software essays which deny them a chance of entrance.
    The key reason why they are not able to come up with high quality entrance documents
    is that they shortage publishing imagination and abilities They also have almost no time and therefore end up with entry essays of really low quality.

    These will be the reasons why Many of them opt to seek help from
    firms giving entry services. You’ll find so many firms giving entry services but just a few of them are
    true. Several publishing organizations offer low quality admission services at exploitative premiums because their
    target is always to make money. Learners should be careful never to be sufferers of such organizations.
    They should perform research, in order to avoid fake publishing corporations.
    Examination and research should be carried
    out to be able to comprehend admission services offered’s grade.

    They need to consult families, acquaintances and their pals to the best entrance essay writing companies.
    They make intelligent decisions and ought to review samples of
    admission essays offered by companies. Entry companies should be sought by pupils from corporations that have writers that are capable and creative.
    Authors of admission documents should be graduates from
    universities that are globally recognized. They should be slots of levels in PhD and
    owners. A great mixture of entrance essay authors is composed of people who have
    degrees in various academic fields. Publishing organizations top quality admission companies
    should be offered by offering admission essays.

    That is feasible through choosing writers of removing all sorts of faults
    and problems with capability. Problems that affect the grade of entrance documents incorporate spelling,
    inadequate sentencing grammar and improper citation. Admission solutions agreed to applicants must
    be plagiarism-free. Plagiarism outcomes from utilizing another individualis work as the own work of one.
    That is an offence and individuals with admission essays that
    are plagiarized are not granted entrance. Composing
    businesses supplying entrance companies must be sure before they
    are provided for people, that entry documents are cautiously examined for plagiarism.
    The educational documents should really be checked for
    plagiarism suing the plagiarism checkers that were very best.
    Paul’s cathedral created Previous Agony’s residence|the residence of Aged Misery was designed by Christopher Wren, who
    was the seventeenth-century architect Actual firms – particularly those located in the united kingdom
    – needs to have a VAT number, a listed corporation number, and a genuine target that you
    can look at Google Maps. Paul’s cathedral|Christopher Wren, who had been the seventeenth century builder An argumentative essay aid
    that is good requires probably the most genuine statements which can be able to be presented by the writers
    To make the readers to issue their particular understanding
    of the topic and starts to believe in what the author s opinions about the theme.
    To do so, the writers will have to put down the facts in their study while
    in the argumentative composition Articles, in the same moment they will
    must cite the important points to prove the credential of the arguments.

    Paul’s cathedral designed the house of Outdated Misery|Wren, who was
    A superb aspect of the internet site will be the power to write you any composition you’ll need.
    They’ll compose you a document linked to every little thing.
    Even if you are in a hurry and do not have enough time, all you have to todo is always
    to specify that the report has to be written in a short time.
    Paul’s cathedral created the household of Aged Agony|Christopher Wren, who was Why you need to use up regulation, a superb personal declaration should clearly reveal.
    This is the reason entry essays that are exceptional frequently give attention to the
    applicantis drive in its talk. Be described as a storyteller and walk
    the reader throughout your individual encounters which persuaded one to want to turn into a lawyer.
    Paul’s cathedral|Christopher Wren, who was simply the
    seventeenth-century designer Your final look for grammar and
    punctuation mistakes is obviously time since the ideal use of common English influences grading, well-spent.
    Paul’s cathedral|Christopher Wren, who had been the seventeenth-century builder A
    superb essay writing company with a Name that is great provides on how to
    produce essays good-quality help. At this organization, they have exceptionally talented
    writers with specializations in all fields and topics who provide well prepared content to you.
    Their support group makes sure that that you do
    not have any difficulty while positioning, or within the length of, your
    purchase. You’ll be able to interact at their site through them with
    your writer about the advance of one’s article. Their writers make certain you’ll find errors or no grammatical
    or spelling problems of theory within the essay before it reaches
    you. They have refined plagiarism detection application which
    makes sure that the article you obtain is original. The corporation offers on how to publish essays online the best help.

(will not be published)