Hi,
I was playing around the new JSON Namespace Support feature.
Seems that when using the "mapped jettison" notation with JAXB beans
having defined namespaces, Jersey throws the following exception, if the
xml2Ns() method is not used:
------------------------------------------------------------------
java.lang.IllegalStateException: Invalid JSON namespace:
urn:oasis:names:specification:ubl:schema:xsd:Order-2
at
org.codehaus.jettison.mapped.MappedNamespaceConvention.getJSONNamespace(MappedNamespaceConvention.java:182)
at
org.codehaus.jettison.mapped.MappedNamespaceConvention.createKey(MappedNamespaceConvention.java:189)
at
org.codehaus.jettison.mapped.MappedXMLStreamWriter.writeStartElement(MappedXMLStreamWriter.java:244)
at
com.sun.xml.bind.v2.runtime.output.XMLStreamWriterOutput.beginStartTag(XMLStreamWriterOutput.java:113)
at
com.sun.xml.bind.v2.runtime.output.XmlOutputAbstractImpl.beginStartTag(XmlOutputAbstractImpl.java:98)
at
com.sun.xml.bind.v2.runtime.output.NamespaceContextImpl$Element.startElement(NamespaceContextImpl.java:491)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.endNamespaceDecls(XMLSerializer.java:287)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:590)
at
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:320)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
at
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
at
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:172)
at
com.sun.jersey.json.impl.BaseJSONMarshaller.marshallToJSON(BaseJSONMarshaller.java:98)
------------------------------------------------------------------
However, for other notations like 'mapped' and 'natural' it just
ignores the namespaces if xml2Ns() method is not called.
Is it an expected behavior for the mapped jettison notation?
Thanks,
Naresh