-
Bug
-
Resolution: Done
-
Major
-
Camel-K-M4
-
None
-
False
-
False
-
%
-
Todo
-
Undefined
-
We have a following integration that is working with camel-k 1.3.2:
package com.test; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.model.dataformat.JsonLibrary; import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; public class MyRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { from("timer:test?repeatCount=1").setBody(constant(initUser().toJson())).to("direct:unmarshal"); from("direct:unmarshal").unmarshal().json(JsonLibrary.Jackson, User.class).to("direct:logger"); from("direct:logger").log("${body}"); } static class User { private String name; private Set<String> hobbies; public String getName() { return name; } public void setName(String name) { this.name = name; } public Set<String> getHobbies() { return hobbies; } public void setHobbies(Set<String> hobbies) { this.hobbies = hobbies; } public String toJson() { return String.format("{\"name\":\"%s\",\"hobbies\":[%s]}", name, getHobbies().stream().map(s -> String.format("\"%s\"", s)).collect(Collectors.joining(","))); } public String toString() { return String.format("User name: %s, hobbies: [%s]", name, getHobbies().stream().map(s -> String.format("\"%s\"", s)).collect(Collectors.joining(","))); } } public User initUser() { final User user = new User(); user.setName("Jan"); Set<String> hobbies = new HashSet<>(); hobbies.add("reading"); hobbies.add("biking"); user.setHobbies(hobbies); return user; } }
1.3.2 log:
... 2021-06-21 07:54:03,086 INFO [org.apa.cam.k.Runtime] (main) Apache Camel K Runtime 1.6.0.fuse-800003-redhat-00001 2021-06-21 07:54:03,102 INFO [org.apa.cam.qua.cor.CamelBootstrapRecorder] (main) bootstrap runtime: org.apache.camel.quarkus.main.CamelMainRuntime 2021-06-21 07:54:03,139 INFO [org.apa.cam.k.lis.SourcesConfigurer] (main) Loading routes from: SourceDefinition{name='MyRouteBuilder', language='java', location='file:/etc/camel/sources/i-source-000/MyRouteBuilder.java', } 2021-06-21 07:54:03,785 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 3.7.0.fuse-800004-redhat-00001 (camel-1) is starting 2021-06-21 07:54:03,786 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) StreamCaching is not in use. If using streams then it's recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html 2021-06-21 07:54:03,789 INFO [org.apa.cam.com.jac.JacksonDataFormat] (main) The option autoDiscoverObjectMapper is set to false, Camel won't search in the registry 2021-06-21 07:54:03,850 INFO [org.apa.cam.imp.eng.InternalRouteStartupManager] (main) Route: route1 started and consuming from: timer://test 2021-06-21 07:54:03,852 INFO [org.apa.cam.imp.eng.InternalRouteStartupManager] (main) Route: route2 started and consuming from: direct://unmarshal 2021-06-21 07:54:03,852 INFO [org.apa.cam.imp.eng.InternalRouteStartupManager] (main) Route: route3 started and consuming from: direct://logger 2021-06-21 07:54:03,854 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Total 3 routes, of which 3 are started 2021-06-21 07:54:03,854 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 3.7.0.fuse-800004-redhat-00001 (camel-1) started in 69ms 2021-06-21 07:54:03,856 INFO [io.quarkus] (main) camel-k-integration 1.3.0 on JVM (powered by Quarkus 1.7.6.Final-redhat-00014) started in 1.086s. 2021-06-21 07:54:03,857 INFO [io.quarkus] (main) Profile prod activated. 2021-06-21 07:54:03,857 INFO [io.quarkus] (main) Installed features: [camel-bean, camel-core, camel-direct, camel-endpointdsl, camel-jackson, camel-k-core, camel-k-loader-java, camel-k-runtime, camel-main, camel-support-common, camel-support-xml, camel-timer, cdi] 2021-06-21 07:54:04,895 INFO [route3] (Camel (camel-1) thread #0 - timer://test) User name: Jan, hobbies: ["reading","biking"]
this doesn't work with camel-k 1.4.0 m4-build1:
... 2021-06-21 08:01:14,925 INFO [org.apa.cam.k.Runtime] (main) Apache Camel K Runtime 1.7.1.fuse-800013-redhat-00001 2021-06-21 08:01:14,927 INFO [org.apa.cam.qua.cor.CamelBootstrapRecorder] (main) bootstrap runtime: org.apache.camel.quarkus.main.CamelMainRuntime 2021-06-21 08:01:14,966 INFO [org.apa.cam.k.lis.SourcesConfigurer] (main) Loading routes from: SourceDefinition{name='MyRouteBuilder', language='java', location='file:/etc/camel/sources/MyRouteBuilder.java', } 2021-06-21 08:01:15,582 INFO [org.apa.cam.com.jac.AbstractJacksonDataFormat] (main) The option autoDiscoverObjectMapper is set to false, Camel won't search in the registry 2021-06-21 08:01:15,622 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Routes startup summary (total:3 started:3) 2021-06-21 08:01:15,622 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Started route1 (timer://test) 2021-06-21 08:01:15,622 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Started route2 (direct://unmarshal) 2021-06-21 08:01:15,622 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Started route3 (direct://logger) 2021-06-21 08:01:15,622 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 3.10.0.fuse-800005-redhat-00001 (camel-1) started in 87ms (build:0ms init:44ms start:43ms) 2021-06-21 08:01:15,624 INFO [io.quarkus] (main) camel-k-integration 1.4.0 on JVM (powered by Quarkus 1.11.7.Final-redhat-00003) started in 1.089s. 2021-06-21 08:01:15,625 INFO [io.quarkus] (main) Profile prod activated. 2021-06-21 08:01:15,625 INFO [io.quarkus] (main) Installed features: [camel-bean, camel-core, camel-direct, camel-jackson, camel-java-joor-dsl, camel-k-core, camel-k-runtime, camel-support-common, camel-timer, cdi] 2021-06-21 08:01:16,636 ERROR [org.apa.cam.pro.err.DefaultErrorHandler] (Camel (camel-1) thread #0 - timer://test) Failed delivery for (MessageId: 36E3D4E1EBE11F5-0000000000000000 on ExchangeId: 36E3D4E1EBE11F5-0000000000000000). Exhausted after delivery attempt: 1 caught: java.lang.IllegalArgumentException: Unrecognized Type: [null] Message History (complete message history is disabled) --------------------------------------------------------------------------------------------------------------------------------------- RouteId ProcessorId Processor Elapsed (ms) [route1 ] [route1 ] [from[timer://test?repeatCount=1] ] [ 14] ... [route2 ] [unmarshal1 ] [unmarshal[org.apache.camel.model.dataformat.JsonDataFormat@706cb08] ] [ 0] Stacktrace --------------------------------------------------------------------------------------------------------------------------------------- : java.lang.IllegalArgumentException: Unrecognized Type: [null] at com.fasterxml.jackson.databind.type.TypeFactory._fromAny(TypeFactory.java:1319) at com.fasterxml.jackson.databind.type.TypeFactory.constructType(TypeFactory.java:698) at com.fasterxml.jackson.databind.cfg.MapperConfig.constructType(MapperConfig.java:306) at com.fasterxml.jackson.databind.ObjectReader.forType(ObjectReader.java:748) at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1468) at org.apache.camel.component.jackson.AbstractJacksonDataFormat.unmarshal(AbstractJacksonDataFormat.java:185) at org.apache.camel.support.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:64) at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:463) at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:179) at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:64) at org.apache.camel.processor.Pipeline.process(Pipeline.java:184) at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:398) at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:209) at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:76) at java.base/java.util.TimerThread.mainLoop(Timer.java:556) at java.base/java.util.TimerThread.run(Timer.java:506) 2021-06-21 08:01:16,638 WARN [org.apa.cam.com.tim.TimerConsumer] (Camel (camel-1) thread #0 - timer://test) Error processing exchange. Exchange[36E3D4E1EBE11F5-0000000000000000]. Caused by: [java.lang.IllegalArgumentException - Unrecognized Type: [null]]: java.lang.IllegalArgumentException: Unrecognized Type: [null] at com.fasterxml.jackson.databind.type.TypeFactory._fromAny(TypeFactory.java:1319) at com.fasterxml.jackson.databind.type.TypeFactory.constructType(TypeFactory.java:698) at com.fasterxml.jackson.databind.cfg.MapperConfig.constructType(MapperConfig.java:306) at com.fasterxml.jackson.databind.ObjectReader.forType(ObjectReader.java:748) at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1468) at org.apache.camel.component.jackson.AbstractJacksonDataFormat.unmarshal(AbstractJacksonDataFormat.java:185) at org.apache.camel.support.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:64) at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:463) at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:179) at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:64) at org.apache.camel.processor.Pipeline.process(Pipeline.java:184) at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:398) at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:209) at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:76) at java.base/java.util.TimerThread.mainLoop(Timer.java:556) at java.base/java.util.TimerThread.run(Timer.java:506)
the same seems to work ok with "standalone" camel-quarkus 1.8.1.fuse-800007-redhat-00001