Hi,

Within a JAX-RS resource I annotated the following method:

@Counted(name = "cesar", absolute = true, monotonic = true)
@GET
public String message() {
    return "Hi Microprofile JWT!";
}


Metric endpoint http://localhost:8181/moviefun/rest/metrics/ works fine.

GET to http://localhost:8181/moviefun/rest/metrics/application returns 200
without any payload back.

But when I try to do a GET to
http://localhost:8181/moviefun/rest/metrics/application/cesar I got:
<!doctype html><html lang="en"><head><title>HTTP Status 500 – Internal
Server Error</title><style type="text/css">h1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
h2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
h3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
body
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
p
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}
a {color:black;} a.name {color:black;} .line
{height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP
Status 500 – Internal Server Error</h1><hr class="line" /><p><b>Type</b>
Exception Report</p><p><b>Message</b> Error processing webservice
request</p><p><b>Description</b> The server encountered an unexpected
condition that prevented it from fulfilling the
request.</p><p><b>Exception</b></p><pre>javax.servlet.ServletException:
Error processing webservice request
org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:98)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65)
org.apache.tomee.microprofile.jwt.MPJWTFilter.doFilter(MPJWTFilter.java:72)
org.apache.geronimo.microprofile.opentracing.microprofile.server.OpenTracingFilter.doFilter(OpenTracingFilter.java:126)
org.apache.tomee.microprofile.jwt.MPJWTFilter.doFilter(MPJWTFilter.java:72)
</pre><p><b>Root Cause</b></p><pre>java.lang.NullPointerException
org.apache.geronimo.microprofile.metrics.jaxrs.PrometheusFormatter.lambda$toText$0(PrometheusFormatter.java:55)
java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
java.util.Collections$2.tryAdvance(Collections.java:4717)
java.util.Collections$2.forEachRemaining(Collections.java:4725)
java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:510)
org.apache.geronimo.microprofile.metrics.jaxrs.PrometheusFormatter.toText(PrometheusFormatter.java:106)
org.apache.geronimo.microprofile.metrics.jaxrs.PrometheusFormatter$$OwbNormalScopeProxy0.toText(org&#47;apache&#47;geronimo&#47;microprofile&#47;metrics&#47;jaxrs&#47;PrometheusFormatter.java)
org.apache.geronimo.microprofile.metrics.jaxrs.MetricsEndpoints.getText(MetricsEndpoints.java:114)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.apache.openejb.server.cxf.rs.PojoInvoker.performInvocation(PojoInvoker.java:43)
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103)
org.apache.openejb.server.cxf.rs.AutoJAXRSInvoker.invoke(AutoJAXRSInvoker.java:68)
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.doInvoke(CxfRsHttpListener.java:253)
org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:94)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65)
org.apache.tomee.microprofile.jwt.MPJWTFilter.doFilter(MPJWTFilter.java:72)
org.apache.geronimo.microprofile.opentracing.microprofile.server.OpenTracingFilter.doFilter(OpenTracingFilter.java:126)
org.apache.tomee.microprofile.jwt.MPJWTFilter.doFilter(MPJWTFilter.java:72)
</pre><p><b>Note</b> The full stack trace of the root cause is available in
the server logs.</p><hr class="line" /><h3>Apache Tomcat (TomEE)/9.0.12
(8.0.0-RC2-SNAPSHOT)</h3></body></html>

In the pom I'm using:

<dependency>
  <groupId>org.eclipse.microprofile.jwt</groupId>
  <artifactId>microprofile-jwt-auth-api</artifactId>
  <version>${mp-jwt.version}</version>
  <scope>provided</scope>
</dependency>

<mp-metric.version>1.1</mp-metric.version>


I notice that if I remove the monotonic = true
Then both endpoint returns empty json response.

Is there any flag I missed to use during tomee:run ?
-- 
Atentamente:
César Hernández Mendoza.

Reply via email to