diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/XmlBasedHttpClientProvider.java b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/XmlBasedHttpClientProvider.java index bcdf08a81c8..44b21f01e33 100644 --- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/XmlBasedHttpClientProvider.java +++ b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/XmlBasedHttpClientProvider.java @@ -34,7 +34,11 @@ class XmlBasedHttpClientProvider public static HttpClient get(@SuppressWarnings("unused") WebSocketContainerScope scope) { - URL resource = Thread.currentThread().getContextClassLoader().getResource("jetty-websocket-httpclient.xml"); + ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); + if (contextClassLoader == null) + return null; + + URL resource = contextClassLoader.getResource("jetty-websocket-httpclient.xml"); if (resource == null) return null;