Metrics NPE query

Question originally posted in Google Groups

Hi

I’m happily using microprofile metrics.

However when my server has just started and my application has deployed and when I start posting requests I sometimes see

Caused by: java.lang.NullPointerException
at fish.payara.microprofile.metrics.cdi.interceptor.AbstractInterceptor.getMetric(AbstractInterceptor.java:84)
at fish.payara.microprofile.metrics.cdi.interceptor.SimplyTimedInterceptor.getMetric(SimplyTimedInterceptor.java:56)
at fish.payara.microprofile.metrics.cdi.interceptor.AbstractInterceptor.apply(AbstractInterceptor.java:74)
at fish.payara.microprofile.metrics.cdi.interceptor.SimplyTimedInterceptor.proceedTimed(SimplyTimedInterceptor.java:72)
at fish.payara.microprofile.metrics.cdi.interceptor.SimplyTimedInterceptor.applyInterceptor(SimplyTimedInterceptor.java:64)
at fish.payara.microprofile.metrics.cdi.interceptor.AbstractInterceptor.preInterceptor(AbstractInterceptor.java:109)
at fish.payara.microprofile.metrics.cdi.interceptor.AbstractInterceptor.methodInvocation(AbstractInterceptor.java:94)

This only happens during startup so it looks like some race condition.

Could it be that metrics has not been fully initialized when my applications starts running?

I tried to reproduce this in a simple application but without success. Usually the problem with race conditions :frowning:

I hope you can help.

regards,

Hans

Thanks for your response. But would this account for the NPE? I would not expect so.