[ 
https://issues.apache.org/jira/browse/CAMEL-23448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18079036#comment-18079036
 ] 

Claus Ibsen commented on CAMEL-23448:
-------------------------------------

Okay we cannot support everything in launcher, and the primary use-cases is all 
the run / export and other camel stuff, so this is not so important. Also jvm 
agents will be not possible to attach in future JDKs

 

 
Starting in JDK 21, dynamic loading of agents (including via remote/local 
Attach API) issues warnings by default, with full disallowance planned for a 
future release (not yet implemented as of JDK 25).
 

>  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
>            Priority: Minor
>
> 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)

Reply via email to