Describe the bug
A warning message is printed when using @Transactional in 1.9.0.Final
Expected behavior
No warning message should show up.
Actual behavior
This message on startup is shown:
CDI: programmatic lookup problem detected
-----------------------------------------
At least one bean matched the required type and qualifiers but was marked as unused and removed during build
Removed beans:
- PRODUCER_METHOD bean io.quarkus.narayana.jta.runtime.NarayanaJtaProducers#userTransaction() [types=[interface javax.transaction.UserTransaction], qualifiers=[@javax.enterprise.inject.Default(), @javax.enterprise.inject.Any()]]
Required type: interface javax.transaction.UserTransaction
Required qualifiers: [@javax.enterprise.inject.Default()]
To Reproduce
Create any project using @Transactional annotation in some bean. Then just package and startup application.
Configuration
Screenshots
Environment (please complete the following information):
uname -a or ver: java -version: JDK 11mvnw --version or gradlew --version): Additional context
Related to https://github.com/quarkusio/quarkus/issues/12420
/cc @mkouba, @manovotn
There doesn't seem to be a change in the bean declaration (e.g. it was always removeable).
I think it's the added logging in ArC causing this to pop up - what does the application do? Just dynamic Instance<UserTransaction> resolution?
I am not doing that resolution in code, just using @Transactional, and some other configs. Maybe this line in properties is related, as it may join a transaction?
quarkus.quartz.store-type=jdbc-cmt
Here is my extension list:
Installed features: [agroal, cdi, flyway, hibernate-orm, hibernate-validator, jdbc-mariadb, mutiny, narayana-jta, rest-client, resteasy, resteasy-jsonb, resteasy-mutiny, scheduler, security, security-jpa, smallrye-context-propagation, smallrye-health, smallrye-jwt, smallrye-openapi, swagger-ui, vertx, vertx-web]
This commit expanded logging to include dynamic resolution (Instance) and was part of 1.9. I think this behaviour is "intended" - as in, someone is trying to (presumably dynamically) resolve UserTransaction at runtime but that bean was removed because there was no injection point detected for it at build time.
The final effect should be the same. The caller will get no matching bean for that search (from which they can recover), the only difference should be the additional logging. In which case it's expected behaviour, WDYT @mkouba?
Yes, it is expected and the naryana extension should fix the problem; i.e. either make the bean unremovable or don't attempt to use CDI.current().select(UserTransaction.class).
To sum up, the issue is that Quartz scheduler uses dynamic resolution in the form of Arc.container().instance(UserTransaction.class) which throws this warning but also mangles the scheduler functionality if the bean was removed.
Thanks for the investigation @ochaloup!
Most helpful comment
Yes, it is expected and the naryana extension should fix the problem; i.e. either make the bean unremovable or don't attempt to use
CDI.current().select(UserTransaction.class).