I am having a similar issue that's been discussed here: com.sun.istack.SAXException2: class java.util.LinkedHashMap nor any of its super class is known to this context
Basically: using JAXB, I want to serialize a 'complex' POJO that's been generated by XJC (and xsd schemas) to XML but the conversion fails with the error:
Caused by: javax.xml.bind.JAXBException: class java.util.LinkedHashMap nor any of its super class is known to this context.
The POJO is complex in the sense that it has fields with type List<Object>
that in runtime gets instantiated to a List<LinkedHashMap<Category>>
. Thus it appears that JAXB does not know how to convert this to XML.
When I add LinkedHashMap.class to the JAXB Context, the serialization succeeds but the xml is incomplete:
<response>
<Common Version="1.1" Lang="EN">
<Option xsi:type="linkedHashMap"/>
</Common>
</response>
The <Common>
node is incomplete because it is serializing Option
but not Category
.
Is this a known issue with JAXB? That it doesn't support serialization of LinkedHashMap data types?
Thank you.