Jiří Ondrušek created CAMEL-24060:
-------------------------------------

             Summary: camel-pqc: PQCMicrometerMetrics static reference breaks 
GraalVM native image compilation
                 Key: CAMEL-24060
                 URL: https://issues.apache.org/jira/browse/CAMEL-24060
             Project: Camel
          Issue Type: Bug
          Components: camel-pqc
            Reporter: Jiří Ondrušek
            Assignee: Jiří Ondrušek


The PQCProducer.createMetrics() method (added in CAMEL-23848) directly imports 
and calls PQCMicrometerMetrics.create(camelContext). While there is a runtime 
classpath guard that prevents loading the class on JVM when micrometer is 
absent, GraalVM native image performs closed-world static analysis and follows 
the bytecode reference to PQCMicrometerMetrics -> 
io.micrometer.core.instrument.Meter, causing:

{code}
Discovered unresolved method during parsing: 
org.apache.camel.component.pqc.metrics.PQCMicrometerMetrics.create(org.apache.camel.CamelContext)
Caused by: java.lang.ClassNotFoundException: io.micrometer.core.instrument.Meter
{code}

*Fix:* Replace the direct PQCMicrometerMetrics.create() call with reflection 
via CamelContext.getClassResolver() so GraalVM never sees a static link to 
micrometer classes.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to