You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@guacamole.apache.org by tucky kong <tu...@gmail.com> on 2019/07/25 12:45:13 UTC

Re: Need help to write Prometheus exporter extension

According to your advice, I wrote my extension with JAX-RS. It worked until
I tried with guacamole 1.0.0. Since then, I got an error 500 with the
following content:

{"message":"Unexpected internal
error","translatableMessage":{"key":"Unexpected internal
error","variables":null},"statusCode":null,"expected":null,"type":"INTERNAL_ERROR"}

Logs give:
ERROR o.a.g.rest.RESTExceptionMapper - Unexpected internal error: null
for uri: http://localhost/guacamole/api/ext/prometheus/metrics
DEBUG o.a.g.rest.RESTExceptionMapper - Unexpected error in REST endpoint.
com.sun.jersey.api.NotFoundException: null for uri:
http://localhost/guacamole/api/ext/prometheus/metrics

what I'm concerned about is that with guacamole 0.9.14 when I tried to
access /api/ext endpoint, I had a 405 error. With guacamole 1.0.0 I
get an error 500 with the following logs:
ERROR o.a.g.rest.RESTExceptionMapper - An internal error occurred, but
did not contain an error message. Enable debug-level logging for
details.
DEBUG o.a.g.rest.RESTExceptionMapper - Unexpected error in REST endpoint.
javax.ws.rs.WebApplicationException: null

I compiled my extension with java 1.6 and 1.7. It runs with TomCat 8.5.

Thanks


Le ven. 14 déc. 2018 à 19:36, Mike Jumper <mj...@apache.org> a écrit :

> On Fri, Dec 14, 2018 at 7:58 AM tucky kong <tu...@gmail.com> wrote:
>
>> Hello,
>>
>> I try to write an extension to export Prometheus metrics with the
>> Promtheus Java client library and
>> I am stuck with the exporting part[1].
>>
>> I need my Guacamole extension to serve a `MetricsServlet` which extends
>> an `HttpServlet`[2].
>>
>> To do so, I tried to extend extend a `ServletModule` that implements the
>> Listener interface with an override of the `configureServlets` method which
>> contains the following code:
>>
>> ```
>> serve("/metrics").with(new MetricsServlet());
>> ```
>>
>> Unfortunately, the `configureServlets` method doesn't seems to be called
>> and Tomcat does not find the `/metrics` path.
>>
>
> A ServletModule will not be automatically loaded by Guacamole. The API
> that Guacamole provides for extensions to add their own endpoints, etc.
> leverages JAX-RS:
>
> http://guacamole.apache.org/doc/gug/guacamole-ext.html#ext-rest-resources
>
> http://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/net/auth/AuthenticationProvider.html#getResource--
>
> http://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/net/auth/UserContext.html#getResource--
>
> Does the library you're trying to use provide support for JAX-RS? If so,
> you could expose a REST resource that serves what you're looking for. That
> would be supported by the Guacamole extension API.
>
> - Mike
>
>

-- 
Philippe

Re: Need help to write Prometheus exporter extension

Posted by Nick Couchman <vn...@apache.org>.
On Fri, Jul 26, 2019 at 3:42 AM tucky kong <tu...@gmail.com> wrote:

>
>
> Le jeu. 25 juil. 2019 à 21:08, Nick Couchman <vn...@apache.org> a écrit :
>
>>
>>
>> On Thu, Jul 25, 2019 at 8:45 AM tucky kong <tu...@gmail.com> wrote:
>>
>>> According to your advice, I wrote my extension with JAX-RS. It worked
>>> until I tried with guacamole 1.0.0. Since then, I got an error 500 with the
>>> following content:
>>>
>>> {"message":"Unexpected internal error","translatableMessage":{"key":"Unexpected internal error","variables":null},"statusCode":null,"expected":null,"type":"INTERNAL_ERROR"}
>>>
>>> Logs give:
>>> ERROR o.a.g.rest.RESTExceptionMapper - Unexpected internal error: null for uri: http://localhost/guacamole/api/ext/prometheus/metrics
>>> DEBUG o.a.g.rest.RESTExceptionMapper - Unexpected error in REST endpoint.
>>> com.sun.jersey.api.NotFoundException: null for uri: http://localhost/guacamole/api/ext/prometheus/metrics
>>>
>>> what I'm concerned about is that with guacamole 0.9.14 when I tried to access /api/ext endpoint, I had a 405 error. With guacamole 1.0.0 I get an error 500 with the following logs:
>>> ERROR o.a.g.rest.RESTExceptionMapper - An internal error occurred, but did not contain an error message. Enable debug-level logging for details.
>>> DEBUG o.a.g.rest.RESTExceptionMapper - Unexpected error in REST endpoint.
>>> javax.ws.rs.WebApplicationException: null
>>>
>>>
>> Well, there's a null value somewhere that there shouldn't be.  There
>> should be some better log messages somewhere that point you to the exact
>> line of code where you're having issues.
>>
>
>
> Sorry, I forgot to give the full stack trace:
>
> 2019/07/26 07:22:47.052 [http-nio-8080-exec-1] ERROR
> o.a.g.rest.RESTExceptionMapper - Unexpected internal error: null for uri:
> http://localhost/guacamole/api/ext/prometheus/metrics
> 2019/07/26 07:22:47.070 [http-nio-8080-exec-1] DEBUG
> o.a.g.rest.RESTExceptionMapper - Unexpected error in REST endpoint.
> com.sun.jersey.api.NotFoundException: null for uri:
> http://localhost/guacamole/api/ext/prometheus/metrics
>
>

Do you have a variable called "uri" somewhere in your code?  I suspect you
do, and I suspect it is null at a time when whatever function you're
calling (_handleRequest) expects it to be non-null.


> at
> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1512)
> [jersey-server-1.17.1.jar:1.17.1]
>         at
> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
> [jersey-server-1.17.1.jar:1.17.1]
>         at
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
> [jersey-server-1.17.1.jar:1.17.1]
>         at
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
> [jersey-server-1.17.1.jar:1.17.1]
>         at
> com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
> [jersey-servlet-1.17.1.jar:1.17.1]
>         at
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
> [jersey-servlet-1.17.1.jar:1.17.1]
>         at
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
> [jersey-servlet-1.17.1.jar:1.17.1]
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
> [servlet-api.jar:na]
>         at
> com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
> [guice-servlet-3.0.jar:na]
>         at
> com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
> [guice-servlet-3.0.jar:na]
>         at
> com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
> [guice-servlet-3.0.jar:na]
>         at
> com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
> [guice-servlet-3.0.jar:na]
>         at
> com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
> [guice-servlet-3.0.jar:na]
>         at
> com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
> [guice-servlet-3.0.jar:na]
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
> [catalina.jar:8.5.41]
>         at
> org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
> [tomcat-coyote.jar:8.5.41]
>         at
> org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
> [tomcat-coyote.jar:8.5.41]
>         at
> org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
> [tomcat-coyote.jar:8.5.41]
>         at
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
> [tomcat-coyote.jar:8.5.41]
>         at
> org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
> [tomcat-coyote.jar:8.5.41]
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> [na:1.8.0_212]
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> [na:1.8.0_212]
>         at
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> [tomcat-util.jar:8.5.41]
>         at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212]
>
> And for the /api/ext endpoint:
> 019/07/26 07:39:05.316 [http-nio-8080-exec-2] ERROR
> o.a.g.rest.RESTExceptionMapper - An internal error occurred, but did not
> contain an error message. Enable debug-level logging for details.
> 2019/07/26 07:39:05.317 [http-nio-8080-exec-2] DEBUG
> o.a.g.rest.RESTExceptionMapper - Unexpected error in REST endpoint.
> javax.ws.rs.WebApplicationException: null
>         at
> com.sun.jersey.server.impl.uri.rules.TerminatingRule.accept(TerminatingRule.java:66)
> ~[jersey-server-1.17.1.jar:1.17.1]
>

Again, there's some place a null value is being passed through to the
accept() method in a TerminatingRule object, and this is unexpected.  While
your code may not care about or deal with null values, whatever it's being
passed on to does care, and these traces should help guide you to where
those errors are.

If you can share your code, someone in the community might be able to spot
the issue.


>         at
> com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
> ~[jersey-server-1.17.1.jar:1.17.1]
>         at
> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
> ~[jersey-server-1.17.1.jar:1.17.1]
>         at
> com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
> ~[jersey-server-1.17.1.jar:1.17.1]
>         at
> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
> [jersey-server-1.17.1.jar:1.17.1]
>         at
> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
> [jersey-server-1.17.1.jar:1.17.1]
>         at
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
> [jersey-server-1.17.1.jar:1.17.1]
>         at
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
> [jersey-server-1.17.1.jar:1.17.1]
>         at
> com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
> [jersey-servlet-1.17.1.jar:1.17.1]
>         at
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
> [jersey-servlet-1.17.1.jar:1.17.1]
>         at
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
> [jersey-servlet-1.17.1.jar:1.17.1]
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
> [servlet-api.jar:na]
>         at
> com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
> [guice-servlet-3.0.jar:na]
>         at
> com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
> [guice-servlet-3.0.jar:na]
>         at
> com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
> [guice-servlet-3.0.jar:na]
>         at
> com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
> [guice-servlet-3.0.jar:na]
>         at
> com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
> [guice-servlet-3.0.jar:na]
>         at
> com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
> [guice-servlet-3.0.jar:na]
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
> [catalina.jar:8.5.41]
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
> [catalina.jar:8.5.41]
>         at
> org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
> [tomcat-coyote.jar:8.5.41]
>         at
> org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
> [tomcat-coyote.jar:8.5.41]
>         at
> org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
> [tomcat-coyote.jar:8.5.41]
>         at
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
> [tomcat-coyote.jar:8.5.41]
>         at
> org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
> [tomcat-coyote.jar:8.5.41]
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> [na:1.8.0_212]
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> [na:1.8.0_212]
>         at
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> [tomcat-util.jar:8.5.41]
>         at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212]
>

-Nick

Re: Need help to write Prometheus exporter extension

Posted by tucky kong <tu...@gmail.com>.
Le jeu. 25 juil. 2019 à 21:08, Nick Couchman <vn...@apache.org> a écrit :

>
>
> On Thu, Jul 25, 2019 at 8:45 AM tucky kong <tu...@gmail.com> wrote:
>
>> According to your advice, I wrote my extension with JAX-RS. It worked
>> until I tried with guacamole 1.0.0. Since then, I got an error 500 with the
>> following content:
>>
>> {"message":"Unexpected internal error","translatableMessage":{"key":"Unexpected internal error","variables":null},"statusCode":null,"expected":null,"type":"INTERNAL_ERROR"}
>>
>> Logs give:
>> ERROR o.a.g.rest.RESTExceptionMapper - Unexpected internal error: null for uri: http://localhost/guacamole/api/ext/prometheus/metrics
>> DEBUG o.a.g.rest.RESTExceptionMapper - Unexpected error in REST endpoint.
>> com.sun.jersey.api.NotFoundException: null for uri: http://localhost/guacamole/api/ext/prometheus/metrics
>>
>> what I'm concerned about is that with guacamole 0.9.14 when I tried to access /api/ext endpoint, I had a 405 error. With guacamole 1.0.0 I get an error 500 with the following logs:
>> ERROR o.a.g.rest.RESTExceptionMapper - An internal error occurred, but did not contain an error message. Enable debug-level logging for details.
>> DEBUG o.a.g.rest.RESTExceptionMapper - Unexpected error in REST endpoint.
>> javax.ws.rs.WebApplicationException: null
>>
>>
> Well, there's a null value somewhere that there shouldn't be.  There
> should be some better log messages somewhere that point you to the exact
> line of code where you're having issues.
>


Sorry, I forgot to give the full stack trace:

2019/07/26 07:22:47.052 [http-nio-8080-exec-1] ERROR
o.a.g.rest.RESTExceptionMapper - Unexpected internal error: null for uri:
http://localhost/guacamole/api/ext/prometheus/metrics
2019/07/26 07:22:47.070 [http-nio-8080-exec-1] DEBUG
o.a.g.rest.RESTExceptionMapper - Unexpected error in REST endpoint.
com.sun.jersey.api.NotFoundException: null for uri:
http://localhost/guacamole/api/ext/prometheus/metrics
        at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1512)
[jersey-server-1.17.1.jar:1.17.1]
        at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
[jersey-server-1.17.1.jar:1.17.1]
        at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
[jersey-server-1.17.1.jar:1.17.1]
        at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
[jersey-server-1.17.1.jar:1.17.1]
        at
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
[jersey-servlet-1.17.1.jar:1.17.1]
        at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
[jersey-servlet-1.17.1.jar:1.17.1]
        at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
[jersey-servlet-1.17.1.jar:1.17.1]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
[servlet-api.jar:na]
        at
com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
[guice-servlet-3.0.jar:na]
        at
com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
[guice-servlet-3.0.jar:na]
        at
com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
[guice-servlet-3.0.jar:na]
        at
com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
[guice-servlet-3.0.jar:na]
        at
com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
[guice-servlet-3.0.jar:na]
        at
com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
[guice-servlet-3.0.jar:na]
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[catalina.jar:8.5.41]
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[catalina.jar:8.5.41]
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
[catalina.jar:8.5.41]
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
[catalina.jar:8.5.41]
        at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
[catalina.jar:8.5.41]
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
[catalina.jar:8.5.41]
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
[catalina.jar:8.5.41]
        at
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
[catalina.jar:8.5.41]
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
[catalina.jar:8.5.41]
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
[catalina.jar:8.5.41]
        at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
[tomcat-coyote.jar:8.5.41]
        at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
[tomcat-coyote.jar:8.5.41]
        at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
[tomcat-coyote.jar:8.5.41]
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
[tomcat-coyote.jar:8.5.41]
        at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
[tomcat-coyote.jar:8.5.41]
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[na:1.8.0_212]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[na:1.8.0_212]
        at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
[tomcat-util.jar:8.5.41]
        at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212]

And for the /api/ext endpoint:
019/07/26 07:39:05.316 [http-nio-8080-exec-2] ERROR
o.a.g.rest.RESTExceptionMapper - An internal error occurred, but did not
contain an error message. Enable debug-level logging for details.
2019/07/26 07:39:05.317 [http-nio-8080-exec-2] DEBUG
o.a.g.rest.RESTExceptionMapper - Unexpected error in REST endpoint.
javax.ws.rs.WebApplicationException: null
        at
com.sun.jersey.server.impl.uri.rules.TerminatingRule.accept(TerminatingRule.java:66)
~[jersey-server-1.17.1.jar:1.17.1]
        at
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
~[jersey-server-1.17.1.jar:1.17.1]
        at
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
~[jersey-server-1.17.1.jar:1.17.1]
        at
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
~[jersey-server-1.17.1.jar:1.17.1]
        at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
[jersey-server-1.17.1.jar:1.17.1]
        at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
[jersey-server-1.17.1.jar:1.17.1]
        at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
[jersey-server-1.17.1.jar:1.17.1]
        at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
[jersey-server-1.17.1.jar:1.17.1]
        at
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
[jersey-servlet-1.17.1.jar:1.17.1]
        at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
[jersey-servlet-1.17.1.jar:1.17.1]
        at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
[jersey-servlet-1.17.1.jar:1.17.1]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
[servlet-api.jar:na]
        at
com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
[guice-servlet-3.0.jar:na]
        at
com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
[guice-servlet-3.0.jar:na]
        at
com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
[guice-servlet-3.0.jar:na]
        at
com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
[guice-servlet-3.0.jar:na]
        at
com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
[guice-servlet-3.0.jar:na]
        at
com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
[guice-servlet-3.0.jar:na]
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[catalina.jar:8.5.41]
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[catalina.jar:8.5.41]
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
[catalina.jar:8.5.41]
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
[catalina.jar:8.5.41]
        at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
[catalina.jar:8.5.41]
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
[catalina.jar:8.5.41]
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
[catalina.jar:8.5.41]
        at
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
[catalina.jar:8.5.41]
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
[catalina.jar:8.5.41]
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
[catalina.jar:8.5.41]
        at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
[tomcat-coyote.jar:8.5.41]
        at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
[tomcat-coyote.jar:8.5.41]
        at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
[tomcat-coyote.jar:8.5.41]
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
[tomcat-coyote.jar:8.5.41]
        at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
[tomcat-coyote.jar:8.5.41]
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[na:1.8.0_212]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[na:1.8.0_212]
        at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
[tomcat-util.jar:8.5.41]
        at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212]


>
>> I compiled my extension with java 1.6 and 1.7. It runs with TomCat 8.5.
>>
>>
> I don't know how related to the error you're seeing this is, but in
> Guacamole 1.0.0 we raised the minimum Java version required to 1.8.  1.8
> has been out for a LONG time, and itself won't be supported much longer, so
> we thought it was pretty safe to move up to that.  You might try with JDK
> 1.8 or better and see if that works.
>
>
Sorry again. I saw it in the changelogs that's why I compiled with *1.8*. I
made a typo in my e-mail. I didn't try with 1.7.

-Nick
>
>>

-- 
Philippe

Re: Need help to write Prometheus exporter extension

Posted by Nick Couchman <vn...@apache.org>.
On Thu, Jul 25, 2019 at 8:45 AM tucky kong <tu...@gmail.com> wrote:

> According to your advice, I wrote my extension with JAX-RS. It worked
> until I tried with guacamole 1.0.0. Since then, I got an error 500 with the
> following content:
>
> {"message":"Unexpected internal error","translatableMessage":{"key":"Unexpected internal error","variables":null},"statusCode":null,"expected":null,"type":"INTERNAL_ERROR"}
>
> Logs give:
> ERROR o.a.g.rest.RESTExceptionMapper - Unexpected internal error: null for uri: http://localhost/guacamole/api/ext/prometheus/metrics
> DEBUG o.a.g.rest.RESTExceptionMapper - Unexpected error in REST endpoint.
> com.sun.jersey.api.NotFoundException: null for uri: http://localhost/guacamole/api/ext/prometheus/metrics
>
> what I'm concerned about is that with guacamole 0.9.14 when I tried to access /api/ext endpoint, I had a 405 error. With guacamole 1.0.0 I get an error 500 with the following logs:
> ERROR o.a.g.rest.RESTExceptionMapper - An internal error occurred, but did not contain an error message. Enable debug-level logging for details.
> DEBUG o.a.g.rest.RESTExceptionMapper - Unexpected error in REST endpoint.
> javax.ws.rs.WebApplicationException: null
>
>
Well, there's a null value somewhere that there shouldn't be.  There should
be some better log messages somewhere that point you to the exact line of
code where you're having issues.


> I compiled my extension with java 1.6 and 1.7. It runs with TomCat 8.5.
>
>
I don't know how related to the error you're seeing this is, but in
Guacamole 1.0.0 we raised the minimum Java version required to 1.8.  1.8
has been out for a LONG time, and itself won't be supported much longer, so
we thought it was pretty safe to move up to that.  You might try with JDK
1.8 or better and see if that works.

-Nick

>