fvcortes opened a new issue, #6049: URL: https://github.com/apache/camel-quarkus/issues/6049
### Bug description ## Issue When attempting to load routes from YAML content using a fresh CamelContext in native execution, the application cannot locate an appropriate RoutesBuilderLoader in the classpath that supports the file extension `.yaml` (camel-quarkus-yaml-dsl dependency included). ## Expected Behavior The expected behavior is to successfully load routes using the fresh CamelContext without errors. ## Actual Behavior Instead, the method call throws an exception when trying to load routes for the given YAML content. ## How to Reproduce A minimal reproducer is set up at: [GitHub - fvcortes/camel-context-main](https://github.com/fvcortes/camel-context-main/tree/master) ### JVM Executable #### Build: ```sh mvn clean package ``` #### Run: ```sh java -jar target/quarkus-app/quarkus-run.jar LSBmcm9tOgogICAgdXJpOiAiZGlyZWN0Om15LXJvdXRlIgogICAgc3RlcHM6CiAgICAgIC0gbG9nOgogICAgICAgICAgbWVzc2FnZTogIkxvZ2dpbmcgZnJvbSBteS1yb3V0ZS4uLiI= ``` #### Output: ``` 2024-04-28 10:55:20,416 INFO [io.quarkus] (main) camel-quarkus-context-main 1.0.0 on JVM (powered by Quarkus 3.9.1) started in 0.540s. 2024-04-28 10:55:20,419 INFO [io.quarkus] (main) Profile prod activated. 2024-04-28 10:55:20,419 INFO [io.quarkus] (main) Installed features: [camel-core, camel-yaml-dsl, cdi] 2024-04-28 10:55:20,496 INFO [org.acm.mai.Main] (main) Routes loaded successfully. 2024-04-28 10:55:20,498 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 4.4.1 (camel-2) is shutting down (timeout:45s) 2024-04-28 10:55:20,502 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Routes stopped (stopped:0) 2024-04-28 10:55:20,511 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 4.4.1 (camel-2) shutdown in 14ms (uptime:) ``` ### Native Executable #### Build: ```sh mvn clean package -Pnative ``` #### Run: ```sh ./target/*-runner LSBmcm9tOgogICAgdXJpOiAiZGlyZWN0Om15LXJvdXRlIgogICAgc3RlcHM6CiAgICAgIC0gbG9nOgogICAgICAgICAgbWVzc2FnZTogIkxvZ2dpbmcgZnJvbSBteS1yb3V0ZS4uLiI= ``` #### Output: ```log 2024-04-28 10:58:46,556 INFO [io.quarkus] (main) camel-quarkus-context-main 1.0.0 native (powered by Quarkus 3.9.1) started in 0.006s. 2024-04-28 10:58:46,556 INFO [io.quarkus] (main) Profile prod activated. 2024-04-28 10:58:46,556 INFO [io.quarkus] (main) Installed features: [camel-core, camel-yaml-dsl, cdi] 2024-04-28 10:58:46,559 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 4.4.1 (camel-2) is shutting down (timeout:45s) 2024-04-28 10:58:46,559 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Routes stopped (stopped:0) 2024-04-28 10:58:46,560 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 4.4.1 (camel-2) shutdown in 0ms (uptime:) 2024-04-28 10:58:46,560 ERROR [io.qua.run.Application] (main) Failed to start application (with profile [prod]): java.lang.IllegalArgumentException: Cannot find RoutesBuilderLoader in classpath supporting file extension: yaml at org.apache.camel.impl.engine.DefaultRoutesLoader.resolveRoutesBuilderLoader(DefaultRoutesLoader.java:298) at org.apache.camel.impl.engine.DefaultRoutesLoader.findRoutesBuilders(DefaultRoutesLoader.java:124) at org.apache.camel.impl.engine.DefaultRoutesLoader.findRoutesBuilders(DefaultRoutesLoader.java:101) at org.apache.camel.spi.RoutesLoader.findRoutesBuilders(RoutesLoader.java:133) at org.apache.camel.spi.RoutesLoader.loadRoutes(RoutesLoader.java:85) at org.acme.main.Main.load(Main.java:58) at org.acme.main.Main.run(Main.java:50) at org.acme.main.Main_ClientProxy.run(Unknown Source) at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:132) at io.quarkus.runtime.Quarkus.run(Quarkus.java:71) at io.quarkus.runtime.Quarkus.run(Quarkus.java:44) at org.acme.main.Main.main(Main.java:38) 2024-04-28 10:58:46,560 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 4.4.1 (camel-1) is shutting down (timeout:45s) 2024-04-28 10:58:46,560 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Routes stopped (stopped:0) 2024-04-28 10:58:46,560 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 4.4.1 (camel-1) shutdown in 0ms (uptime:) 2024-04-28 10:58:46,561 INFO [io.quarkus] (main) camel-quarkus-context-main stopped in 0.000s ``` ## Alternative Solution For this specific task of dynamically loading routes, I've set up a branch in the reproducer that utilizes the CamelRuntime retrieved from Quarkus ARC. This provides a CamelContext that successfully loads routes in native mode: [GitHub Branch - arc-camel-context-main](https://github.com/fvcortes/camel-context-main/tree/arc-camel-context-main) This issue may not necessarily be a bug, but rather unexpected behavior from which I was expecting more clarity. I might be missing something about Camel context initialization in a Camel-Quarkus environment and would appreciate enlightenment on this topic. Thank you in advance for your help. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
