Quarkus IllegalStateException: No current Vertx context found
Issue
- Quarkus test failure:
@QuarkusTest
class WidgetResourceTest {
@Test
void create() {
given()
.body("{\"name\": \"MyWidget\"}")
.contentType(ContentType.JSON)
.when().post("/widget")
.then()
.statusCode(CREATED.getStatusCode())
.body(
"name", is("MyWidget")
);
assertThat(Widget.findById(1).await().indefinitely(), notNullValue());
}
}
$ ./mvnw quarkus:dev
...
ERROR [io.qua.test] (Test runner thread) ==================== TEST REPORT #1 ====================
ERROR [io.qua.test] (Test runner thread) Test WidgetResourceTest#create() failed
: java.lang.IllegalStateException: No current Vertx context found
at io.quarkus.hibernate.reactive.panache.common.runtime.SessionOperations.vertxContext(SessionOperations.java:194)
at io.quarkus.hibernate.reactive.panache.common.runtime.SessionOperations.getSession(SessionOperations.java:145)
at io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations.getSession(AbstractJpaOperations.java:364)
at io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations.findById(AbstractJpaOperations.java:98)
at com.example.Widget.findById(Widget.java)
at com.example.WidgetResourceTest.create(WidgetResourceTest.java:30)
Environment
- Red Hat build of Quarkus (RHBQ) 3.2.10
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.