Uploaded image for project: 'A-MQ Broker'
  1. A-MQ Broker
  2. ENTMQBR-1046

hawtio not escaping jolokia urls with exclamation points correctly

    Details

    • Type: Bug
    • Status: Done
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: AMQ 7.0.1.GA, AMQ 7.1.0.CR2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Target Release:
    • Steps to Reproduce:
      Hide

      Create a queue named foo/bar, request the jolokia url of one of the queue properties and invoke that url in a browser or using command line curl. It will fail.

      Sample url:

      http://localhost:8161/hawtio/jolokia/read/org.apache.activemq.artemis:broker="testBroker",component=addresses,address="foo/bar",subcomponent=queues,routing-type="anycast",queue="foo/bar"/MessageCount

      Full error returned:

      {
      "stacktrace": "java.lang.IllegalArgumentException: Invalid object name. Unterminated quoted value\n\tat org.jolokia.request.JmxRequestFactory.createGetRequest(JmxRequestFactory.java:99)\n\tat org.jolokia.http.HttpRequestHandler.handleGetRequest(HttpRequestHandler.java:79)\n\tat org.jolokia.http.AgentServlet$4.handleRequest(AgentServlet.java:430)\n\tat org.jolokia.http.AgentServlet.handleSecurely(AgentServlet.java:301)\n\tat org.jolokia.http.AgentServlet.handle(AgentServlet.java:277)\n\tat org.jolokia.http.AgentServlet.doGet(AgentServlet.java:237)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:687)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:790)\n\tat org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)\n\tat io.hawt.web.AuthenticationFilter$3.run(AuthenticationFilter.java:201)\n\tat java.security.AccessController.doPrivileged(Native Method)\n\tat javax.security.auth.Subject.doAs(Subject.java:422)\n\tat io.hawt.web.AuthenticationFilter.executeAs(AuthenticationFilter.java:198)\n\tat io.hawt.web.AuthenticationFilter.doFilter(AuthenticationFilter.java:136)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)\n\tat io.hawt.web.CORSFilter.doFilter(CORSFilter.java:42)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)\n\tat io.hawt.web.XXSSProtectionFilter.doFilter(XXSSProtectionFilter.java:28)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)\n\tat io.hawt.web.XFrameOptionsFilter.doFilter(XFrameOptionsFilter.java:28)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)\n\tat io.hawt.web.SessionExpiryFilter.process(SessionExpiryFilter.java:148)\n\tat io.hawt.web.SessionExpiryFilter.doFilter(SessionExpiryFilter.java:46)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1613)\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:541)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1593)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1239)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:481)\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1562)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1141)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\n\tat org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)\n\tat org.eclipse.jetty.server.Server.handle(Server.java:564)\n\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)\n\tat org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)\n\tat org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)\n\tat org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)\n\tat java.lang.Thread.run(Thread.java:748)\nCaused by: javax.management.MalformedObjectNameException: Unterminated quoted value\n\tat javax.management.ObjectName.construct(ObjectName.java:599)\n\tat javax.management.ObjectName.<init>(ObjectName.java:1382)\n\tat org.jolokia.request.JmxObjectNameRequest.initObjectName(JmxObjectNameRequest.java:130)\n\tat org.jolokia.request.JmxObjectNameRequest.<init>(JmxObjectNameRequest.java:53)\n\tat org.jolokia.request.JmxReadRequest.<init>(JmxReadRequest.java:56)\n\tat org.jolokia.request.JmxReadRequest$1.create(JmxReadRequest.java:157)\n\tat org.jolokia.request.JmxReadRequest$1.create(JmxReadRequest.java:151)\n\tat org.jolokia.request.JmxRequestFactory.createGetRequest(JmxRequestFactory.java:97)\n\t... 49 more\n",
      "error_type": "java.lang.IllegalArgumentException",
      "error": "java.lang.IllegalArgumentException : Invalid object name. Unterminated quoted value",
      "status": 400
      }
      
      Show
      Create a queue named foo/bar , request the jolokia url of one of the queue properties and invoke that url in a browser or using command line curl. It will fail. Sample url: http://localhost:8161/hawtio/jolokia/read/org.apache.activemq.artemis:broker= "testBroker",component=addresses,address="foo/bar",subcomponent=queues,routing-type="anycast",queue="foo/bar"/MessageCount Full error returned: { "stacktrace" : "java.lang.IllegalArgumentException: Invalid object name. Unterminated quoted value\n\tat org.jolokia.request.JmxRequestFactory.createGetRequest(JmxRequestFactory.java:99)\n\tat org.jolokia.http.HttpRequestHandler.handleGetRequest(HttpRequestHandler.java:79)\n\tat org.jolokia.http.AgentServlet$4.handleRequest(AgentServlet.java:430)\n\tat org.jolokia.http.AgentServlet.handleSecurely(AgentServlet.java:301)\n\tat org.jolokia.http.AgentServlet.handle(AgentServlet.java:277)\n\tat org.jolokia.http.AgentServlet.doGet(AgentServlet.java:237)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:687)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:790)\n\tat org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)\n\tat io.hawt.web.AuthenticationFilter$3.run(AuthenticationFilter.java:201)\n\tat java.security.AccessController.doPrivileged(Native Method)\n\tat javax.security.auth.Subject.doAs(Subject.java:422)\n\tat io.hawt.web.AuthenticationFilter.executeAs(AuthenticationFilter.java:198)\n\tat io.hawt.web.AuthenticationFilter.doFilter(AuthenticationFilter.java:136)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)\n\tat io.hawt.web.CORSFilter.doFilter(CORSFilter.java:42)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)\n\tat io.hawt.web.XXSSProtectionFilter.doFilter(XXSSProtectionFilter.java:28)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)\n\tat io.hawt.web.XFrameOptionsFilter.doFilter(XFrameOptionsFilter.java:28)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)\n\tat io.hawt.web.SessionExpiryFilter.process(SessionExpiryFilter.java:148)\n\tat io.hawt.web.SessionExpiryFilter.doFilter(SessionExpiryFilter.java:46)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1613)\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:541)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1593)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1239)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:481)\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1562)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1141)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\n\tat org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)\n\tat org.eclipse.jetty.server.Server.handle(Server.java:564)\n\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)\n\tat org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)\n\tat org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)\n\tat org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)\n\tat java.lang. Thread .run( Thread .java:748)\nCaused by: javax.management.MalformedObjectNameException: Unterminated quoted value\n\tat javax.management.ObjectName.construct(ObjectName.java:599)\n\tat javax.management.ObjectName.<init>(ObjectName.java:1382)\n\tat org.jolokia.request.JmxObjectNameRequest.initObjectName(JmxObjectNameRequest.java:130)\n\tat org.jolokia.request.JmxObjectNameRequest.<init>(JmxObjectNameRequest.java:53)\n\tat org.jolokia.request.JmxReadRequest.<init>(JmxReadRequest.java:56)\n\tat org.jolokia.request.JmxReadRequest$1.create(JmxReadRequest.java:157)\n\tat org.jolokia.request.JmxReadRequest$1.create(JmxReadRequest.java:151)\n\tat org.jolokia.request.JmxRequestFactory.createGetRequest(JmxRequestFactory.java:97)\n\t... 49 more\n" , "error_type" : "java.lang.IllegalArgumentException" , "error" : "java.lang.IllegalArgumentException : Invalid object name. Unterminated quoted value" , "status" : 400 }

      Description

      Original description:

      Hawtio of AMQ 7 allows to retrieve the Jolokia url for any resource property and operation.
      However the url it generates does not always follow the escaping rules of jolokia.

      In particular if a request part contains a / character, it needs to be escaped with !/ as per the escaping rules given in. This is not the case with the jolokia urls generated by hawtio.

      E.g. If a destination name contains /, it must be escaped.
      So a destination named foo/bar must be escaped to foo!/bar.

      As a result, jolokia urls retrieved programmatically from hawtio, cannot be used without additional escaping.

      Outstanding, non-case related, work revolves around the exclamation point as per this comment in the previous ENTMQBR-779.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  tadayosi Tadayoshi Sato
                  Reporter:
                  roddiekieley Roderick Kieley
                  Tester:
                  Michal Toth
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  8 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: