JiriOndrusek opened a new issue, #9385:
URL: https://github.com/apache/camel-quarkus/issues/9385
### Describe the bug
A native build of an app that uses both `camel-quarkus-jpa` and
`camel-quarkus-management` (or `camel-quarkus-observability-services`, which
brings management) fails:
```
Fatal error: com.oracle.graal.pointsto.util.AnalysisError$ParsingError:
Error encountered while parsing
org.apache.camel.processor.idempotent.jpa.JpaMessageIdRepository.<init>(JpaMessageIdRepository.java:61)
...
Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException:
Discovered unresolved type during parsing:
org.apache.camel.component.jpa.DefaultTransactionStrategy
...
Caused by: java.lang.ClassNotFoundException:
org.apache.camel.component.jpa.DefaultTransactionStrategy
```
### Cause
- `JpaProcessor` removes `DefaultTransactionStrategy`
(`RemovedResourceBuildItem`), since Quarkus provides its own transaction
strategy.
- `ManagementProcessor` registers all constructors and methods of
`@ManagedResource` classes for reflection. That makes the
`JpaMessageIdRepository` constructor that does `new
DefaultTransactionStrategy(...)` reachable, although the app never calls it.
### Reproducer
Add `camel-quarkus-management` to `integration-tests/jpa` (17 lines in
`pom.xml`):
https://github.com/jiriOndrusek-agent/camel-quarkus/tree/agent_jpa-management-native-reproducer-q3
(on c4eb7f6e64, Quarkus 3.40.1)
```
mvn install -Dquickly -pl integration-tests/jpa -am
mvn install -Dquickly -pl poms/bom,poms/bom-test
mvn verify -f integration-tests/jpa -Dnative -Ddocker
-Dquarkus.native.container-runtime=podman
```
- Without management, the same native build passes (`JpaIT` 6/6).
- On main the failure is the same (branch
`agent_jpa-management-native-reproducer`). JPA native is already disabled there
by #9357, so it needs `-Dquarkus.build.skip=false`.
### Possible fix
In `JpaProcessor`, rewrite
`JpaMessageIdRepository.createDefaultTransactionStrategy` (and probably
`JpaKeyValueRepository.doInit()`) by bytecode transformation to use
`QuarkusTransactionStrategy`. `JpaEndpoint` and `JpaComponent` are already
handled this way. Skipping removed classes in `ManagementProcessor` would not
help, because `DefaultTransactionStrategy` itself is not a managed class.
Related: #9357, #9154 (same pattern in kamelet).
_Generated with [Claude Code](https://claude.com/claude-code) on behalf of
@JiriOndrusek_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]