Salvatore Mongiardo created CAMEL-23448:
-------------------------------------------
Summary: camel-launcher jolokia fails to attach agent — JAR path
unresolvable from nested Spring Boot JAR
Key: CAMEL-23448
URL: https://issues.apache.org/jira/browse/CAMEL-23448
Project: Camel
Issue Type: Bug
Components: camel-core
Affects Versions: 4.18.1
Reporter: Salvatore Mongiardo
Fix For: 4.18.1
When running `camel-launcher jolokia <name>`, the Jolokia agent fails to attach
to the target JVM:
{code:java}
ERROR: Cannot execute jolokia command due: Error while loading Jolokia agent to
a JVM process {code}
*Root cause:*
_OptionsAndArgs.lookupJarFile()_ in the Jolokia library resolves the agent JAR
path via:
_OptionsAndArgs.class.getProtectionDomain().getCodeSource().getLocation()_
This works when camel-jbang runs via JBang (dependencies are real files in
~/.m2/repository/), but fails with camel-launcher because:
# camel-launcher is packaged as a Spring Boot executable JAR using
camel-repackager-maven-plugin
# The Jolokia JAR is nested inside
BOOT-INF/lib/jolokia-agent-jvm-<version>-javaagent.jar
# getCodeSource().getLocation() returns a jar:file: URL pointing inside the
fat JAR
# VirtualMachine.loadAgent() requires a real filesystem path — it cannot load
an agent from a nested JAR
--
This message was sent by Atlassian Jira
(v8.20.10#820010)