diff --git a/dd-java-agent/instrumentation/tomcat/tomcat-9.0/src/main/java/datadog/trace/instrumentation/tomcat9/WebappClassLoaderInstrumentation.java b/dd-java-agent/instrumentation/tomcat/tomcat-9.0/src/main/java/datadog/trace/instrumentation/tomcat9/WebappClassLoaderInstrumentation.java index ccd92cba35c..83d86feb898 100644 --- a/dd-java-agent/instrumentation/tomcat/tomcat-9.0/src/main/java/datadog/trace/instrumentation/tomcat9/WebappClassLoaderInstrumentation.java +++ b/dd-java-agent/instrumentation/tomcat/tomcat-9.0/src/main/java/datadog/trace/instrumentation/tomcat9/WebappClassLoaderInstrumentation.java @@ -41,7 +41,7 @@ public static void onContextAvailable( @Advice.This final WebappClassLoaderBase classLoader, @Advice.Argument(0) final WebResourceRoot webResourceRoot) { // at this moment we have the context set in this classloader, hence its name - final Context context = webResourceRoot.getContext(); + final Context context = webResourceRoot != null ? webResourceRoot.getContext() : null; if (context == null) { return; }