diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/integration/resteasy/ResteasyVertxProvider.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/integration/resteasy/ResteasyVertxProvider.java index a811898d2e..a67e043c79 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/integration/resteasy/ResteasyVertxProvider.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/integration/resteasy/ResteasyVertxProvider.java @@ -23,6 +23,8 @@ import io.vertx.ext.web.RoutingContext; import org.jboss.resteasy.core.ResteasyContext; import org.keycloak.common.util.ResteasyProvider; +import java.util.Optional; + public class ResteasyVertxProvider implements ResteasyProvider { @Override @@ -30,7 +32,9 @@ public class ResteasyVertxProvider implements ResteasyProvider { R data = ResteasyContext.getContextData(type); if (data == null) { - RoutingContext contextData = Arc.container().instance(CurrentVertxRequest.class).get().getCurrent(); + RoutingContext contextData = Optional.ofNullable(Arc.container()) + .map(c -> c.instance(CurrentVertxRequest.class).get()).map(CurrentVertxRequest::getCurrent) + .orElse(null); if (contextData == null) { return null;