HBASE-19424 Fix NPE in "/metrics" servlet.

Signed-off-by: Apekshit Sharma <appy@apache.org>
This commit is contained in:
Toshihiro Suzuki 2018-01-08 15:10:42 -08:00 committed by Apekshit Sharma
parent 2509a150c0
commit f29260cc4d
1 changed files with 3 additions and 0 deletions

View File

@ -591,6 +591,9 @@ public class HttpServer implements FilterContainer {
ctx.setContextPath("/");
ctx.setWar(appDir + "/" + name);
ctx.getServletContext().setAttribute(CONF_CONTEXT_ATTRIBUTE, conf);
// for org.apache.hadoop.metrics.MetricsServlet
ctx.getServletContext().setAttribute(
org.apache.hadoop.http.HttpServer2.CONF_CONTEXT_ATTRIBUTE, conf);
ctx.getServletContext().setAttribute(ADMINS_ACL, adminsAcl);
addNoCacheFilter(ctx);
return ctx;