diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index 5ca2bc8b933..c0d24299611 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -1623,6 +1623,9 @@ public class Request implements HttpServletRequest throw new IllegalStateException("No SessionManager"); _session = _sessionHandler.newHttpSession(this); + if (_session == null) + throw new IllegalStateException("Create session failed"); + HttpCookie cookie = _sessionHandler.getSessionCookie(_session, getContextPath(), isSecure()); if (cookie != null) _channel.getResponse().replaceCookie(cookie);