Announcement Announcement Module
No announcement yet.
Unable to use Jaxb2Marshaller with an XmlAdapter Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to use Jaxb2Marshaller with an XmlAdapter


    I'm facing the following problem (not related to WS directly, but I post here because of the JAXB component) :
    I want to Marshall a to xml. But this object does not have a no-arg constructor as the Jaxb2Marshaller says

    Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions does not have a no-arg default constructor.
    	this problem is related to the following location:
    So I create a SimpleTweet class that simply propose the same get/set but with a default constructor.
    Then I create a TweetAdapter to link those two classes.

    Next, I change my Jaxb2Manager configuration like this.

    HTML Code:
    <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
            <property name="classesToBeBound">
            <property name="adapters">
                    <bean class="test.TweetAdapter" />
    But I still get the same error message. Do I forget something ?
    Note that I can't modify the original Tweet class to add an Annotation.

    Thanks in advance
    Last edited by Proner; Apr 18th, 2012, 05:22 PM.