We have just upgraded our Camel project from the version 4.4.0 to the version 4.9.0. And we encountered this error when sending our JMS messages :
java.lang.IllegalArgumentException: Unrecognized Type: [null] at com.fasterxml.jackson.databind.type.TypeFactory._fromAny(TypeFactory.java:1472) at com.fasterxml.jackson.databind.type.TypeFactory.constructType(TypeFactory.java:778) at com.fasterxml.jackson.databind.cfg.MapperConfig.constructType(MapperConfig.java:337) at com.fasterxml.jackson.databind.ObjectReader.forType(ObjectReader.java:791) at org.apache.camel.component.jackson.AbstractJacksonDataFormat.unmarshal(AbstractJacksonDataFormat.java:203) at org.apache.camel.support.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:85) at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:808) at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:714) at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.doRun(DefaultReactiveExecutor.java:199) at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.executeReactiveWork(DefaultReactiveExecutor.java:189) at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.tryExecuteReactiveWork(DefaultReactiveExecutor.java:166) at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148) at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleSync(DefaultReactiveExecutor.java:64) at org.apache.camel.processor.MulticastProcessor.lambda$schedule$1(MulticastProcessor.java:388) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833)
By debugging the EndpointMessageListener
class of Camel, I have noticed that a JMS header used to deserialize our messages was missing and was used to specify the Class to be used to unmarshall the data : the CamelJacksonUnmarshalType
header.
I've found out that this is due to the JmsHeaderFilterStrategy
class that sets its internal filters in its constructor to filter every JMS Headers beginning with "Camel". In comparison wit the older version 4.4.0 we were using, these filters were null and everything worked fine.
I've tried to change some options in the CamelContext
, but it did nothing.
I'll post in answer how I've overridden this strategy to solve my problem. But if you have a better solution to handle it, don't hesitate to share it.