failure with Jolokia GET request when mbean name contains double quote

classic Classic list List threaded Threaded
1 message Options
rong.chen rong.chen
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

failure with Jolokia GET request when mbean name contains double quote

This post was updated on .
We are using Jolokia Java Client library to retrieve information related to a mbean like:

j4pClient.execute(new J4pReadRequest(mBeanName));

Whenever mbean name contains double quote such as:

Catalina:class=org.apache.catalina.UserDatabase,name="UserDatabase",resourcetype=Global,type=Resource

The call always fail with org.jolokia.client.exception.J4pRemoteException: Bad Request

As I understand it, using Jolokia java library with the read request, as long as mBeanName is valid string, it should work.

I also experimented multiple ways with curl:

1. escape double quote and url encoding

curl https://--my-jmxclient-url--/read/Catalina:class=org.apache.catalina.UserDatabase,name=%21%21%22UserDatabase%21%21%22,resourcetype=Global,type=Resource?ignoreErrors=true

response is empty

2. no escape of double quote, just url encoding

curl https://--my-jmxclient-url/read/Catalina:class=org.apache.catalina.UserDatabase,name=%22UserDatabase%22,resourcetype=Global,type=Resource?ignoreErrors=true

response is empty

3. using query parameter and url encoding

curl https://--my-jmxclient-url--?p=/read/Catalina:class=org.apache.catalina.UserDatabase,name=%22UserDatabase%22,resourcetype=Global,type=Resource&ignoreErrors=true

response is:
{"request":{"mbean":"Catalina:class=org.apache.catalina.UserDatabase,name=\"UserDatabase\",resourcetype=Global,type=Resource","type":"read"},"stacktrace":"javax.management.AttributeNotFoundException: Cannot find attribute modelerType\n\tat org.apache.catalina.mbeans.ContextResourceMBean.getAttribute(ContextResourceMBean.java:113)\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$2.execute(ReadHandler.java:60)\n\tat org.jolokia.backend.executor.AbstractMBeanServerExecutor.call(AbstractMBeanServerExecutor.java:90)\n\tat org.jolokia.handler.ReadHandler.getAttribute(ReadHandler.java:235)\n\tat org.jolokia.handler.ReadHandler.fetchAttributes(ReadHandler.java:189)\n\tat org.jolokia.handler.ReadHandler.doHandleRequest(ReadHandler.java:118)\n\tat org.jolokia.handler.ReadHandler.doHandleRequest(ReadHandler.java:37)\n\tat org.jolokia.handler.JsonRequestHandler.handleRequest(JsonRequestHandler.java:160)\n\tat org.jolokia.backend.MBeanServerHandler.dispatchRequest(MBeanServerHandler.java:97)\n\tat org.jolokia.backend.LocalRequestDispatcher.dispatchRequest(LocalRequestDispatcher.java:98)\n\tat org.jolokia.backend.BackendManager.callRequestDispatcher(BackendManager.java:411)\n\tat org.jolokia.backend.BackendManager.handleRequest(BackendManager.java:158)\n\tat org.jolokia.http.HttpRequestHandler.executeRequest(HttpRequestHandler.java:197)\n\tat org.jolokia.http.HttpRequestHandler.handleGetRequest(HttpRequestHandler.java:86)\n\tat org.jolokia.http.AgentServlet$4.handleRequest(AgentServlet.java:435)\n\tat org.jolokia.http.AgentServlet.handleSecurely(AgentServlet.java:320)\n\tat org.jolokia.http.AgentServlet.handle(AgentServlet.java:291)\n\tat org.jolokia.http.AgentServlet.doGet(AgentServlet.java:252)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:622)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:729)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)\n\tat org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)\n\tat org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:120)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)\n\tat veeva.ecm.config.interfaces.web.IpSecurityFilter.doFilter(IpSecurityFilter.java:42)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)\n\tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)\n\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)\n\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)\n\tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)\n\tat org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)\n\tat org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:676)\n\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)\n\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)\n\tat org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)\n\tat org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)\n\tat org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)\n\tat org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n\tat org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)\n\tat java.lang.Thread.run(Thread.java:745)\n","error_type":"javax.management.AttributeNotFoundException","error":"javax.management.AttributeNotFoundException : Cannot find attribute modelerType","status":404}

Thanks for any prompt response.
Loading...