stataru8 commented on issue #504: URL: https://github.com/apache/camel-karaf/issues/504#issuecomment-2400681911
Hello, and thanks for sharing. I couldn’t reproduce the issue on my end. Am I missing something? Route in blueprint file: ``` <route id="jaxb-route"> <from uri="timer://foo?period=10000"/> <log message="START route"/> <setBody> <constant> <![CDATA[ <MyData> <randomField>Johnny</randomField> <name/> <nikname>Johnny</nikname> <age>30</age> <asset> <name>Car</name> <inherited>1</inherited> <age>true</age> </asset> </MyData> ]]> </constant> </setBody> <camel:log message="Will unmarshal: ${body}"/> <camel:unmarshal> <camel:jaxb contextPath="org.apache.karaf.camel.test"/> </camel:unmarshal> <camel:log message="Unmarshalled: ${body}"/> <log message="FINISH route"/> </route> ``` logs in my console: ``` 21:26:31.009 INFO [Camel (camel-1) thread #1 - timer://foo] START route 21:26:31.010 INFO [Camel (camel-1) thread #1 - timer://foo] Will unmarshal: <MyData> <randomField>Johnny</randomField> <name/> <nikname>Johnny</nikname> <age>30</age> <asset> <name>Car</name> <inherited>1</inherited> <age>true</age> </asset> </MyData> 21:26:31.012 INFO [Camel (camel-1) thread #1 - timer://foo] Unmarshalled: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <MyData> <asset> <age>0</age> <inherited>true</inherited> <name>Car</name> </asset> <age>30</age> <name></name> </MyData> 21:26:31.014 INFO [Camel (camel-1) thread #1 - timer://foo] FINISH route ``` `MyData class` ``` package org.apache.karaf.camel.test; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "MyData") public class MyData { private String name; private int age; @XmlElement(name="asset") private Asset asset; // getters and setters ... (except getter for asset) } ``` `Asset class` ``` package org.apache.karaf.camel.test; public class Asset { private String name; private boolean inherited; private int age; // getters and setters ... } ``` `ObjectFactory class` ``` package org.apache.karaf.camel.test; import jakarta.xml.bind.annotation.XmlRegistry; @XmlRegistry public class ObjectFactory { public ObjectFactory() { } public MyData create() { return new MyData(); } } ``` I placed two files inside karaf's deploy folder: - a jar file that is a bundle exporting the package `org.apache.karaf.camel.test`, containing the three classes I shared. - a xml blueprint file with the route I shared. In my setup, I've noticed the blueprint bundle hangs when deploying and undeploying the JAR file. However, I assume that in your scenario, you have a bundle containing both the blueprint and the target package with the classes. Could you share more information ? 🙏 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org