JAXB annotations appear to be missing from classes in JBoss EAP 6

Solution Verified - Updated -

Issue

  • While executing the following code snippet:
import com.redhat.gss.MyObject;
import javax.xml.bind.JAXBContext;
JAXBContext jc = JAXBContext.newInstance(MyObject.class); 
  • It runs fine in a standalone environment, but in JBoss, getting the following error:
Caused by: com.sun.istack.SAXException2: 
unable to marshal type "com.my.example.request.Payment" as an element 
because it is missing an @XmlRootElement annotation
  • The @XmlRootElement annotation is present on MyObject, though. Why can't JAXB see it?

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.