[jboss-user] [Beginner's Corner] New message: "JBoss Gotcha with JAXB and Stax 1.0.1"

Jon Kranes do-not-reply at jboss.com
Sun Jan 10 10:00:06 EST 2010


User development,

A new message was posted in the thread "JBoss Gotcha with JAXB and Stax 1.0.1":

http://community.jboss.org/message/519134#519134

Author  : Jon Kranes
Profile : http://community.jboss.org/people/jkranes

Message:
--------------------------------------------------------------
I recently solved a problem that I had when porting a working web application from Tomcat 6 to JBoss AS 5.1.0,GA
 
The observed symptom was that the application, deployed on Jboss, throws com.sun.xml.bind.v2.runtime.IllegalAnnotationsExceptions, with the message "javax.xml.namespace.QName does not have a no-arg default constructor".  The exception is thrown when calling
 
JAXBContext.newInstance([contextPath]);
 
After much hair-pulling I finally traced the problem to the inclusion of the Stax-api 1.0.1 jar in my application.  This jar was included as an indirect dependency from Apache XMLBeans 2.4.0.  The problem was solved by excluding the Stax dependency in my maven pom.xml file.  The root cause of the problem is presumably related to the fact that the Stax 1.0.1 jar file includes a version of javax.xml.namespace.QName, which is also included in the 1.6 JRE.  Apparently this version of QName does not play nice with JAXB.
 
Note that this problem did not appear when deploying the exact same .war file in either Tomcat 6.18 or in GlassFish 2.1.1 running under the same 1.6.0_18 JDK that I was running for JBoss AS.  So presumably there is some difference in the JBoss classloader that caused it to load the QName class from the Stax API jar while the other servers loaded it from the JRE rt.jar.

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/519134#519134




More information about the jboss-user mailing list