Hi Arne- I’ve worked in the model generation space a long time and found that the jaxb tools have the most comprehensive set of capabilities (I haven’t checked in on json-generation in a while though).
With jaxb-tools, you can generate model classes from xsd schema(s), have code modules that extend models from other projects without duplicate generation, and annotate with the Jackson JSON bindings — so the single model class can be rendered XML or JSON. Additionally, it was recently added to allow jaxb generation to _not_ generate the XML annotations, so the tools can be used to generate modular models that are Java-only or JSON-only. jaxb-tools project: https://github.com/highsource/jaxb-tools Annotation plugin (to add Jackson JSON bindings) https://github.com/highsource/jaxb-tools?tab=readme-ov-file#jaxb-annotate-plugin Hope this helps! Thanks, Matt Pavlovich Disclaimer: I am one of the maintainers that helped take over the project after Alexei passed away. > On Oct 13, 2025, at 9:25 AM, Bedürftig, Arne > <[email protected]> wrote: > > Hi > > Thank you for the quick response. Are there any plans to change that? How is > this xmlDataFormat configuration option meant to be used, if I cannot use > anything else but JAXB? > > My use-case: > > I generate the models with Swagger Code generator and the Java lang > generator. The one that works best only includes JSON annotations. JAXB > doesn’t serialize those models without further effort, which is why I wanted > to try JacksonXML. > > I would like to stick with generated models and use auto-binding if possible. > > Do you suggest continuing with JAXB in Rest or to turn off binding in > implement serialization myself? > > -- > > Von: Claus Ibsen <[email protected]> > Datum: Montag, 13. Oktober 2025 um 16:16 > An: [email protected] <[email protected]> > Betreff: [[email protected]] Re: > Rest with Binding xml or auto always depends on JAXB through > RestBindingAdviceFactory PluginHelper.getRestBindingJaxbDataFormatFactory > > Hi > > You cannot use jacksonXml for XML data binding. > That is JAXB, so don't change it. > > > On Mon, Oct 13, 2025 at 4:13 PM Bedürftig, Arne > <[email protected]> wrote: > >> Hello, >> >> I want to use jacksonXml as the xmlDateFormat for my Rest bindings. >> >> restConfiguration() >> .bindingMode(RestBindingMode.json_xml) // or auto >> .jsonDataFormat("jackson") >> .xmlDataFormat("jacksonXml“) >> >> Note, I am also using Spring Boot and have the following dependency added. >> >> <dependency> >> <groupId>org.apache.camel.springboot</groupId> >> <artifactId>camel-jacksonxml-starter</artifactId> >> </dependency> >> >> camel-jaxb is not on the classpath. >> >> When I start my application, I get this: >> >> Caused by: java.lang.IllegalArgumentException: Cannot find >> RestBindingJaxbDataFormatFactory on classpath. Add camel-jaxb to classpath. >> at >> org.apache.camel.impl.engine.SimpleCamelContext.createRestBindingJaxbDataFormatFactory(SimpleCamelContext.java:635) >> ~[camel-base-engine-4.14.1.jar:4.14.1] >> at >> org.apache.camel.impl.engine.DefaultCamelContextExtension.lazyInitAndAdd(DefaultCamelContextExtension.java:1133) >> ~[camel-base-engine-4.14.1.jar:4.14.1] >> at >> org.apache.camel.impl.engine.DefaultCamelContextExtension.lambda$lazyAddContextPlugin$0(DefaultCamelContextExtension.java:1129) >> ~[camel-base-engine-4.14.1.jar:4.14.1] >> at >> org.apache.camel.impl.engine.DefaultContextPluginManager.getContextPlugin(DefaultContextPluginManager.java:43) >> ~[camel-base-engine-4.14.1.jar:4.14.1] >> at >> org.apache.camel.impl.engine.DefaultCamelContextExtension.getContextPlugin(DefaultCamelContextExtension.java:1104) >> ~[camel-base-engine-4.14.1.jar:4.14.1] >> at >> org.apache.camel.support.PluginHelper.getRestBindingJaxbDataFormatFactory(PluginHelper.java:451) >> ~[camel-support-4.14.1.jar:4.14.1] >> at >> org.apache.camel.support.PluginHelper.getRestBindingJaxbDataFormatFactory(PluginHelper.java:443) >> ~[camel-support-4.14.1.jar:4.14.1] >> at >> org.apache.camel.support.processor.RestBindingAdviceFactory.build(RestBindingAdviceFactory.java:115) >> ~[camel-support-4.14.1.jar:4.14.1] >> at >> org.apache.camel.reifier.rest.RestBindingReifier.createRestBindingAdvice(RestBindingReifier.java:90) >> ~[camel-core-reifier-4.14.1.jar:4.14.1] >> at >> org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:335) >> ~[camel-core-reifier-4.14.1.jar:4.14.1] >> >> When I add camel-jaxb, then I get this: >> >> Caused by: java.lang.ClassCastException: class >> org.apache.camel.component.jacksonxml.JacksonXMLDataFormat cannot be cast >> to class org.apache.camel.converter.jaxb.JaxbDataFormat >> (org.apache.camel.component.jacksonxml.JacksonXMLDataFormat and >> org.apache.camel.converter.jaxb.JaxbDataFormat are in unnamed module of >> loader 'app') >> at >> org.apache.camel.converter.jaxb.JaxbDataFormatConfigurer.configure(JaxbDataFormatConfigurer.java:21) >> ~[camel-jaxb-4.14.1.jar:4.14.1] >> at >> org.apache.camel.support.PropertyBindingSupport.setSimplePropertyViaConfigurer(PropertyBindingSupport.java:806) >> ~[camel-support-4.14.1.jar:4.14.1] >> >> Looking at the code, it seems like even though jacksonXml has been defined >> as the data format, it will still try to load the JaxbDataFormat via the >> RestBindingAdviceFactory. >> >> if (jaxb != null) { >> // to setup JAXB we need to use camel-jaxb >> >> PluginHelper.getRestBindingJaxbDataFormatFactory(camelContext).setupJaxb(camelContext, >> config, >> bc.getType(), bc.getTypeClass(), >> bc.getOutType(), bc.getOutTypeClass(), >> jaxb, outJaxb); >> } >> >> The variable jaxb is not null, because "jaxb = >> camelContext.createDataFormat(name);“ and it will be of type >> JacksonXMLDataFormat. >> >> Am I missing a configuration, or is Jackson XML not meant to work with >> Rest? >> >> Thank you in advance. >> >> Regards, >> Arne B. >> -- >> >> >> ------------------------------------------------------------------------------ >> Informationen (einschließlich Pflichtangaben und Datenschutzerklärungen) >> zu einzelnen, innerhalb der EU tätigen Gesellschaften und >> Zweigniederlassungen der CITTI-Gruppe finden Sie unter >> http://www.citti.de/html/pflichtangaben.html. Diese E-Mail enthält >> vertrauliche und/ oder rechtlich geschützte Informationen. Wenn Sie nicht >> der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, >> informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. >> Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist >> nicht gestattet. >> >> Please refer to http://www.citti.de/html/pflichtangaben.html for >> information (including mandatory corporate particulars and data protection >> declarations) on selected CITTI branches and group companies registered or >> incorporated in the European Union. This e-mail may contain confidential >> and/or privileged information. If you are not the intended recipient (or >> have received this e-mail in error) please notify the sender immediately >> and delete this e-mail. Any unauthorized copying, disclosure or >> distribution of the material in this e-mail is strictly forbidden. >> >> ------------------------------------------------------------------------------ >> > > > -- > Claus Ibsen > ------------------------------------------------------------------------------ > Informationen (einschließlich Pflichtangaben und Datenschutzerklärungen) zu > einzelnen, innerhalb der EU tätigen Gesellschaften und Zweigniederlassungen > der CITTI-Gruppe finden Sie unter > http://www.citti.de/html/pflichtangaben.html. Diese E-Mail enthält > vertrauliche und/ oder rechtlich geschützte Informationen. Wenn Sie nicht der > richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, > informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. > Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist > nicht gestattet. > > Please refer to http://www.citti.de/html/pflichtangaben.html for information > (including mandatory corporate particulars and data protection declarations) > on selected CITTI branches and group companies registered or incorporated in > the European Union. This e-mail may contain confidential and/or privileged > information. If you are not the intended recipient (or have received this > e-mail in error) please notify the sender immediately and delete this e-mail. > Any unauthorized copying, disclosure or distribution of the material in this > e-mail is strictly forbidden. > ------------------------------------------------------------------------------
