Open AlexandreGuidin opened 3 years ago
/cc @DavideD, @FroMage, @Sanne, @gavinking, @loicmathieu
I've created a new project from https://code.quarkus.io/?g=org.test&e=resteasy-reactive&e=resteasy-reactive-jackson&e=hibernate-reactive-panache&e=reactive-pg-client and copy Fruit
and FruitResource
from quickstart
Weird that with Maven it works, but Gradle it not, it throws that exception Already tried to clear gradle cache files, but no success
I have the same error. I additionally used Kotlin as programming language.
Try adding quarkus-narayana-jta -- hibernate reactive depends on hibernate orm which depends on agroal / jta for some reason (not used in reactive?)
quarkus-narayana-jta
It worked. Don't know if i should add it, but it work for now.
This is a very weird issue. It appears it was introduced by https://github.com/smallrye/smallrye-context-propagation/commit/eb454a70ca03b1aa6ddc8fa8a862db954d68a527 which introduced LifecycleManager
in https://github.com/smallrye/smallrye-context-propagation/commit/eb454a70ca03b1aa6ddc8fa8a862db954d68a527#diff-6719340760b3e74dbd9230d39c1f683af6390f27307ee70d4660b917031f2f90R165 but we forgot to mark the bean as unremovable if smallrye-context-propagation-jta is present.
Actually not true, since extensions/narayana-jta/deployment/src/main/java/io/quarkus/narayana/jta/deployment/NarayanaJtaProcessor.java
marks it:
@BuildStep
UnremovableBeanBuildItem unremovableBean() {
// LifecycleManager comes from smallrye-context-propagation-jta and is only used via programmatic lookup in JtaContextProvider
return UnremovableBeanBuildItem.beanClassNames(JtaContextProvider.LifecycleManager.class.getName());
}
Ah, got it, it's normally imported by quarkus-hibernate-orm
but is explicitely excluded by quarkus-hibernate-reactive
:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm</artifactId>
<exclusions>
<exclusion>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-agroal</artifactId>
</exclusion>
<exclusion>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-narayana-jta</artifactId>
</exclusion>
</exclusions>
</dependency>
I guess I can tweak smallrye-context-propagation-jta
to consider that if LifecycleManager
is not available, then JTA must have been disabled. It's kinda weird, but it'd work.
Or I can make quarkus-hibernate-reactive
mark LifecycleManager
as unremovable. That would also work, and perhaps be less weird, since it acknowledges that our import has an exclusion that has some side-effect. JTA would still not be propagated since TransactionManager
would be an empty proxy.
WDYT @stuartwdouglas ?
@FroMage
Other weird thing, you see that maven projects it works, but gradle it not ?
at least until version 2.0.1.Final
I think not propagating JTA is fine for HR.
JTA TX commit is a blocking operation, so we really don't want JTA for a 100% reactive approach anyway.
I added a preliminary fix in SR-CP at https://github.com/smallrye/smallrye-context-propagation/pull/299 because I actually get an exception myself, before I get this warning, so it's more severe. Then I'll fix the warning too in Quarkus in https://github.com/quarkusio/quarkus/pull/18893
Describe the bug
I've updated to Quarkus 2.0.1.Final and then updated
hibernate panache
toreactive
version and it start logging this error after o make a request to whatever urlI've tried to delete almost everything of my code and configs to reach the cause of it, but the error keep logging
I tried to reproduce the same error with https://github.com/quarkusio/quarkus-quickstarts/tree/main/hibernate-reactive-panache-quickstart but even if i add all of my libraries, and change the
active record pattern
torepository pattern
, add a liquibase and other stuff that i have in my project, i never got the same error here.The only differente is that i use gradle and this quickstart use maven
I found same error without solution here https://stackoverflow.com/questions/67904868/quarkus-hibernate-no-bean-found-for-required-type-interface-javax-transaction-t. (it have some error at his configuration, but the error is the same of mine)
I'm out of ideas to fix it :(
To Reproduce
I could not share my project, and i was not able to reproduce this error on quickstart :(
But here are my configs