DefaultJAXBContextImpl does not have a no-arg default constructor

Posted on 2011-10-16
Last Modified: 2013-11-23
I have generated my JAXB classes using XJC Jars with the following version.

xjc version "1.0.6-01/24/2006 06:08 PM(kohsuke)-fcs"
JavaTM Architecture for XML Binding(JAXB) Reference Implementation, (build 1.0.6
-01/24/2006 06:08 PM(kohsuke)-fcs)

I am trying to deploy the application in Websphere application server 6.1. While trying to access the jaxb related classes for unmarshalling the data from database, I am getting the following errors.

[10/16/11 4:48:28:849 MST] 00000033 SystemErr     R com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions does not have a no-arg default constructor.
        this problem is related to the following location:

[10/16/11 4:48:28:850 MST] 00000033 SystemErr     R     at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(
[10/16/11 4:48:28:850 MST] 00000033 SystemErr     R     at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(
[10/16/11 4:48:28:850 MST] 00000033 SystemErr     R     at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContext

I think WAS 6.1 supports JAXB 2.0, but also it should be backward compatible.
I am able to run the same application code on my local machinem but getting the above error when I am deploying it on the WAS 6.1 server in Dev environment.

Any clues ??


Question by:satishkunchala
    LVL 47

    Expert Comment

    Look at this piece of code (taken from
    somewhere close to the point where you are getting the error

    Class cls = DefaultJAXBContextImpl.class;
    ProtectionDomain pDomain = cls.getProtectionDomain();
    CodeSource cSource = pDomain.getCodeSource();
    URL loc = cSource.getLocation(); 
    // prints something like "c:/jars/MyFoo.jar"

    Open in new window

    If you add such code for DefaultJAXBContextImpl.class
    it will print form which .jar is this class coming from

    So you can make sure that it comes form the right jar

    This trick helped us to find the solution in similar case:


    Author Comment

    Thanks for the information.
    DefaultJAXBContextImpl is the source file which is
    I have checked the JAXBContext class and the DefaultJAXBContextImpl.class and both classes are getting picked from the expected locations.
    JAXBContext is coming from opt/websphere/Appserver/plugins/
    and the DefaultJAXBContextImpl.class is picking from the project jar file.
     The issue remains the same and not sure what is going wrong.

    The classloader is also showing up fine.
    this.jaxbContext = JAXBContext.newInstance("", this.getClass().getClassLoader());

    The root cause is, I am unable to get this JAXBContext which is leading to the error.

    There is not even a single annotation in those JAXB generated classes as I am using JAXB 1.0 XJC.
    I am surprised to see that illegalAnnotationException there. Any pointers are greatly appreciated.
    LVL 47

    Expert Comment

    Do you know what is the source of this  class:

    Is it a new application which you are debugging or it has already been working before?

    Accepted Solution

    This is a new application. Never mind. The issue is with the entries and I am able to solve the issue now. Thanks for all your help.
    LVL 59

    Expert Comment

    by:Kevin Cross
    This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Suggested Solutions

    Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
    This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now