This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 4f02d7584fc7 chore: camel-jbang - one SLF4J provider in
camel-jbang-mcp, and camel_get_log names no picocli frame as the user's code
(#28118)
4f02d7584fc7 is described below
commit 4f02d7584fc770958f28b5d66bcab91d59df5681
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Oct 19 19:37:28 2026 +0200
chore: camel-jbang - one SLF4J provider in camel-jbang-mcp, and
camel_get_log names no picocli frame as the user's code (#28118)
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
---
.../dsl/jbang/core/commands/ai/LogFileReader.java | 7 +++++--
.../jbang/core/commands/ai/LogFileReaderTest.java | 23 ++++++++++++++++++++++
dsl/camel-jbang/camel-jbang-mcp/pom.xml | 7 +++++++
3 files changed, 35 insertions(+), 2 deletions(-)
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/LogFileReader.java
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/LogFileReader.java
index 97deb8002518..3466f5e4ca21 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/LogFileReader.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/LogFileReader.java
@@ -64,11 +64,14 @@ public final class LogFileReader {
/** A frame of a stack trace: {@code at
org.example.OrderBean.process(OrderBean.java:42)}. */
private static final Pattern FRAME = Pattern.compile("^\\tat
(\\S+\\(.*\\))$");
- /** Frames of the runtime, not of the user's code: Camel, the JDK, Groovy,
Vert.x and the like. */
+ /**
+ * Frames of the runtime, not of the user's code: Camel, the JDK, Groovy,
Vert.x and the like, and picocli, the
+ * command line library of the CLI, which a start that failed has under
the frames of Camel.
+ */
private static final List<String> RUNTIME_PACKAGES = List.of(
"org.apache.camel.", "java.", "javax.", "jakarta.", "jdk.",
"sun.", "com.sun.", "groovy.",
"org.codehaus.groovy.", "org.apache.groovy.", "io.vertx.",
"io.netty.", "io.smallrye.", "io.quarkus.",
- "org.springframework.", "com.fasterxml.", "org.jboss.", "kotlin.");
+ "org.springframework.", "com.fasterxml.", "org.jboss.", "kotlin.",
"picocli.");
/** Internal fields of a record, removed before it is returned. */
private static final String TRACE = "_trace";
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/LogFileReaderTest.java
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/LogFileReaderTest.java
index 2958961f458c..109a110ed1e8 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/LogFileReaderTest.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/LogFileReaderTest.java
@@ -212,6 +212,29 @@ class LogFileReaderTest {
"the JDK frame of the root cause is not the user's code, and
the frame that called it is above");
}
+ @Test
+ void aStartThatFailedHasNoFrameOfTheUsersCode() {
+ // after the frames of Camel come those of the CLI and of picocli, its
command line library: no user's code
+ List<String> lines = List.of(
+ "2026-10-19 12:58:17.301 ERROR 40927 --- [ main]
org.apache.camel.main.MainSupport : Error"
+ + " starting Camel:
org.apache.camel.FailedToStartRouteException: Failed to start route:"
+ + " route1 because:
java.lang.IllegalStateException: Cannot find RestApiProcessorFactory",
+ "org.apache.camel.FailedToStartRouteException: Failed to start
route: route1 because:"
+
+ "
java.lang.IllegalStateException: Cannot find RestApiProcessorFactory",
+ "\tat
org.apache.camel.impl.engine.AbstractCamelContext.doStartRoute(AbstractCamelContext.java:1300)",
+ "\tat
org.apache.camel.main.KameletMain.doStart(KameletMain.java:433)",
+ "\tat
org.apache.camel.dsl.jbang.core.commands.Run.runKameletMain(Run.java:3067)",
+ "\tat
picocli.CommandLine.executeUserObject(CommandLine.java:2031)",
+ "\tat picocli.CommandLine.access$1500(CommandLine.java:148)",
+ "\tat
org.apache.camel.dsl.jbang.launcher.CamelLauncher.main(CamelLauncher.java:46)",
+ "\tat
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)",
+ "\tat
org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:40)");
+
+ JsonObject error = (JsonObject) LogFileReader.build(lines, 50, null,
null, false, new JsonObject())
+ .getCollection("lines").iterator().next();
+ assertNull(error.get("at"), "no frame is of the user's code: " +
error);
+ }
+
@Test
void aGroovyScriptIsTheUsersCode() {
List<String> lines = List.of(
diff --git a/dsl/camel-jbang/camel-jbang-mcp/pom.xml
b/dsl/camel-jbang/camel-jbang-mcp/pom.xml
index 875b94462163..1f8e127949e1 100644
--- a/dsl/camel-jbang/camel-jbang-mcp/pom.xml
+++ b/dsl/camel-jbang/camel-jbang-mcp/pom.xml
@@ -84,6 +84,13 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jbang-core</artifactId>
+ <exclusions>
+ <!-- Quarkus provides the SLF4J provider (JBoss LogManager): a
second one makes SLF4J warn at every start -->
+ <exclusion>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j2-impl</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<!-- Camel Catalog (needed at runtime for DefaultCamelCatalog /
AbstractCamelCatalog) -->