Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
1.5.0, 1.6.0
-
None
Description
JaxbDataFormat reuses the Marshaller/Unmarshaller instances.
However, according to the https://jaxb.dev.java.net/faq/index.html#threadSafety, Marshaller/Unmarshaller instances are NOT thread safe, so you can't use them from separate threads at the same time.
Due to this we are getting exceptions from the JAXB implementation (like ClassCastException or "org.xml.sax.SAXException: FWK005 parse may not be called while parsing."). Everything works nice with our custom JaxbDataFormat that creates new Unmarshaller/Marshaller instance on every request.
Also, lazy-creating instances (like JAXBContext) in getter methods is not thread-safe as well (because explicit synchronization is required).