Quicktipp: Working with more than one package name in a JAXB Context Config in Mule ESB

If you want to structure your code with packages for different JAXB annotated classes, for example after generating JAXB from different WSDLs, do not try to define severall jaxb context elements in Mule ESB, as this is going to fail at runtime.

...
<mulexml:jaxb-context name=“JAXB_Context1“ packageNames=“org.example.test1“ doc:name=“JAXB Context1“ />
<mulexml:jaxb-context name=“JAXB_Context2“ packageNames=“org.example.test2“ doc:name=“JAXB Context2“ />
...

This results in: org.mule.api.registry.RegistrationException: More than one object of type class javax.xml.bind.JAXBContext registered but only one expected.

The right way to this is to separate packages via a “:”.

...
<mulexml:jaxb-context name=“JAXB_Context1“ packageNames=“org.example.test1: org.example.test2“ doc:name=“JAXB Context1“ />
...