pmartin8
pmartin8

Reputation: 1584

Jolokia crashes when response too big

I'm trying to run this on my tomcat with Jolokia installed.

http://myserver/jolokia/read/Catalina:type=ThreadPool,name=*/

What I get is this

{"error_type":"javax.management.RuntimeOperationsException","error":"javax.management.RuntimeOperationsException : Exception invoking method readBufSize","status":500,"stacktrace":"javax.management.RuntimeOperationsException: Exception invoking method readBufSize\n\tat org.apache.tomcat.util.modeler.BaseModelMBean.getAttribute(BaseModelMBean.java:197)\n\tat com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:647)\n\tat com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)\n\tat org.jolokia.handler.ReadHandler.getAttribute(ReadHandler.java:208)\n\tat org.jolokia.handler.ReadHandler.fetchAttributes(ReadHandler.java:158)\n\tat org.jolokia.handler.ReadHandler.fetchAttributesForMBeanPattern(ReadHandler.java:97)\n\tat org.jolokia.handler.ReadHandler.doHandleRequest(ReadHandler.java:82)\n\tat org.jolokia.handler.ReadHandler.doHandleRequest(ReadHandler.java:34)\n\tat org.jolokia.handler.JsonRequestHandler.handleRequest(JsonRequestHandler.java:150)\n\tat org.jolokia.backend.MBeanServerHandler.dispatchRequest(MBeanServerHandler.java:91)\n\tat org.jolokia.backend.LocalRequestDispatcher.dispatchRequest(LocalRequestDispatcher.java:81)\n\tat org.jolokia.backend.BackendManager.callRequestDispatcher(BackendManager.java:196)\n\tat org.jolokia.backend.BackendManager.handleRequest(BackendManager.java:175)\n\tat org.jolokia.http.HttpRequestHandler.executeRequest(HttpRequestHandler.java:150)\n\tat org.jolokia.http.HttpRequestHandler.handleGetRequest(HttpRequestHandler.java:79)\n\tat org.jolokia.http.AgentServlet$3.handleRequest(AgentServlet.java:239)\n\tat org.jolokia.http.AgentServlet.handle(AgentServlet.java:200)\n\tat org.jolokia.http.AgentServlet.doGet(AgentServlet.java:183)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:621)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:728)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)\n\tat org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)\n\tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)\n\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)\n\tat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)\n\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)\n\tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)\n\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)\n\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)\n\tat org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)\n\tat org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)\n\tat org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1721)\n\tat org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1679)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)\n\tat java.lang.Thread.run(Thread.java:744)\nCaused by: java.lang.NullPointerException\n\tat org.apache.tomcat.util.net.SocketProperties.getRxBufSize(SocketProperties.java:239)\n\tat org.apache.tomcat.util.net.NioEndpoint.getReadBufSize(NioEndpoint.java:619)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:606)\n\tat org.apache.tomcat.util.modeler.BaseModelMBean.getAttribute(BaseModelMBean.java:190)\n\t... 38 more\n"}

It looks like Jolokia can't handle large responses. Any way I can fix the problem? I just need a few attributes but I couldn't figure out how to get 2 attributes in a single request.

Here is my jolokia version

{"timestamp":1405453600,"status":200,"request":{"type":"version"},"value":{"protocol":"5.0","agent":"0.95","info":{"product":"tomcat","vendor":"Apache","version":"7.0.47"}}}

Upvotes: 0

Views: 646

Answers (1)

Roland Huß
Roland Huß

Reputation: 2525

That's probably not the full stack trace. It's not about that Jolokia can't handle large objects (well, if there is an issue, it's something of you sercer container), since you get a complete response. The reason (hidden in the "38 more") is that the method 'getReadBufSize' throws an exception.

You have two options, though:

  • Use the query parameter ignoreErrors=true which is quite useful if you do bulk requests like this.
  • You can indeed choose multiple attributes: For a GET request simply concatanate them with ',', for POST requests use an JSON Array. All is explained in the reference manual. For your request:http://myserver/jolokia/read/Catalina:type=ThreadPool,name=*/attr1,attr2 You need a post 1.0.0 Jolokia agent, though.

Upvotes: 1

Related Questions