This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.10.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.10.x by this push:
new 428536ae78b CAMEL-21846: camel-jbang - Add support for running other
JVMs such as Eclipse OpenJ9 that does not include JFR flight-recorder
428536ae78b is described below
commit 428536ae78b0538b960754b16e87e12648b0d206
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Mar 6 19:36:12 2025 +0100
CAMEL-21846: camel-jbang - Add support for running other JVMs such as
Eclipse OpenJ9 that does not include JFR flight-recorder
---
.../org/apache/camel/main/BaseMainSupport.java | 27 ++++++++++++++--------
.../java/org/apache/camel/main/KameletMain.java | 3 ++-
2 files changed, 20 insertions(+), 10 deletions(-)
diff --git
a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
index 57ac46692d9..d287df5cc02 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
@@ -679,15 +679,24 @@ public abstract class BaseMainSupport extends BaseService
{
||
"java-flight-recorder".equals(mainConfigurationProperties.getStartupRecorder())
|| mainConfigurationProperties.getStartupRecorder() == null) {
// try to auto discover camel-jfr to use
- StartupStepRecorder fr = ecc.getBootstrapFactoryFinder()
- .newInstance(StartupStepRecorder.FACTORY,
StartupStepRecorder.class).orElse(null);
- if (fr != null) {
- LOG.debug("Discovered startup recorder: {} from classpath",
fr);
-
fr.setRecording(mainConfigurationProperties.isStartupRecorderRecording());
-
fr.setStartupRecorderDuration(mainConfigurationProperties.getStartupRecorderDuration());
-
fr.setRecordingProfile(mainConfigurationProperties.getStartupRecorderProfile());
-
fr.setMaxDepth(mainConfigurationProperties.getStartupRecorderMaxDepth());
-
camelContext.getCamelContextExtension().setStartupStepRecorder(fr);
+ try {
+ StartupStepRecorder fr = ecc.getBootstrapFactoryFinder()
+ .newInstance(StartupStepRecorder.FACTORY,
StartupStepRecorder.class).orElse(null);
+ if (fr != null) {
+ LOG.debug("Discovered startup recorder: {} from
classpath", fr);
+
fr.setRecording(mainConfigurationProperties.isStartupRecorderRecording());
+
fr.setStartupRecorderDuration(mainConfigurationProperties.getStartupRecorderDuration());
+
fr.setRecordingProfile(mainConfigurationProperties.getStartupRecorderProfile());
+
fr.setMaxDepth(mainConfigurationProperties.getStartupRecorderMaxDepth());
+
camelContext.getCamelContextExtension().setStartupStepRecorder(fr);
+ }
+ } catch (NoClassDefFoundError | Exception e) {
+ if (mainConfigurationProperties.getStartupRecorder() != null) {
+ throw new IllegalArgumentException(
+ "Flight recorder is not available in the JVM or
camel-jfr is not available on the classpath due to: "
+ + e.getMessage(),
+ e);
+ }
}
}
}
diff --git
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
index ff74cec1e4c..7cce0b7691d 100644
---
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
+++
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
@@ -859,7 +859,8 @@ public class KameletMain extends MainCommandLineSupport {
protected String startupInfo() {
StringBuilder sb = new StringBuilder();
- sb.append("Using Java ").append(System.getProperty("java.version"));
+ sb.append("Using Java
").append(System.getProperty("java.version")).append(" (")
+ .append(System.getProperty("java.vm.name")).append(")");
sb.append(" with PID ").append(getPid());
sb.append(". Started by ").append(System.getProperty("user.name"));
sb.append(" in ").append(System.getProperty("user.dir"));