JaxbDataFormat is not thread-safe
---------------------------------

                 Key: CAMEL-1401
                 URL: https://issues.apache.org/activemq/browse/CAMEL-1401
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-jaxb
    Affects Versions: 1.6.0, 1.5.0
            Reporter: Ivan S. Dubrov
            Priority: Critical


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).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to