[Quarkus]java.lang.IllegalStateException: No current Mutiny.Session found

Solution Unverified - Updated -

Issue

I have some Panache Entity

@Entity
public class Test extends PanacheEntity {

    public String Order1;
    public String Order2;
    public String jiraKey;
    public String username;

}

And Resource where I want to transformt Uni into Multi

@Path("/api")
public class TestResource {

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Multi<Test> getAll() {

        Uni<List<Test>> orders = Test.<Test> listAll();

        return (Multi<Test>) orders.toMulti().flatMap(list -> Multi.createFrom().iterable(list));
    }
}
ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (vert.x-eventloop-thread-1) HTTP Request to /api failed, error id: c2c0913c-cf00-4412-9212-f562a22d19cd-1: java.lang.IllegalStateException: No current Mutiny.Session found
    - no reactive session was found in the context and the context was not marked to open a new session lazily
    - you might need to annotate the business method with @WithSession
    at io.quarkus.hibernate.reactive.panache.common.runtime.SessionOperations.getSession(SessionOperations.java:163)
    at io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations.getSession(AbstractJpaOperations.java:364)
    at io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations.findAll(AbstractJpaOperations.java:180)
    at io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations.listAll(AbstractJpaOperations.java:191)

Environment

  • Red Hat build of Quarkus
    • 3.2.10

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content