diff --git a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java index cf2fba2d306a..7bbc574a25ff 100644 --- a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java +++ b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java @@ -157,6 +157,9 @@ public static ServletContextHandler getServletContextHandler(ServletContext serv { if (servletContext instanceof ServletContextApi servletContextApi) return servletContextApi.getContext().getServletContextHandler(); + ServletContextHandler sch = getCurrentServletContextHandler(); + if (sch != null) + return sch; throw new IllegalStateException("No Jetty ServletContextHandler, " + purpose + " unavailable"); }