NPE is thrown when running in spring-boot
ralf0131 opened this issue · 0 comments
ralf0131 commented
A java application running under spring boot:
2019-03-14 11:46:07.202 ERROR 20364 --- [rter-1-thread-1] com.alibaba.metrics.tomcat.HttpGaugeSet : Exception occur when getting connector global stats:
java.lang.NullPointerException: null
at com.alibaba.metrics.tomcat.HttpGaugeSet.getValueInternal(HttpGaugeSet.java:87)
at com.alibaba.metrics.CachedMetricSet.refreshIfNecessary(CachedMetricSet.java:48)
at com.alibaba.metrics.tomcat.HttpGaugeSet$HttpStatGauge.getValue(HttpGaugeSet.java:169)
at com.alibaba.metrics.reporter.bin.StructMetricManagerReporter.report(StructMetricManagerReporter.java:123)
at com.alibaba.metrics.reporter.MetricManagerReporter.report(MetricManagerReporter.java:249)
at com.alibaba.metrics.reporter.MetricManagerReporter$1.run(MetricManagerReporter.java:67)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:308)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
It looks when populating metrics, there was only 1 connector returned by calling JMXUtils.getObjectNames(globalReqProcessor)
, however, during runtime, there is 2 connectors returned by calling the same method.
I think the code should check for possible newly added connectors during runtime.