users@jersey.java.net

[Jersey] Marshall Exception with linked JAXB exception when sending a map with a list

From: <reaganej_at_gmail.com>
Date: Tue, 27 Sep 2011 13:51:10 +0000 (GMT)

Hello,
     I have a class like below which has a map that has a map with a
list in it

e.g. Map<String, Map<String, List<Flight>>> map ....

   I have followed instructions online to make a wrapper class for
collections and maps.

e.g
@XmlRootElement
public class XCollection
{
    @XmlElementWrapper
    @XmlElement
    public List getList()....
}

@XmlRootElement
public class XMap
{
     @XmlRootElementWrapper
     @XmlELement
     public LIst<XEntry<K,V>>()...
}

  I can send a list with a PUT request just fine using the above
XCollection class. I can also send a simple Map of String, String just
find using a PUT request and the above class.

  When I try and wrap my Map<String, Map<String, List<Flight>>> as a
XMap<String, XMap<String, XCollection>>> I get the above exception.

I don't understand why I am unable to create a map when I have
registered my XCollection in my provider class and my XMap? Am I doing
something really wrong or do I have a misunderstanding on how JAXB
works?