Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4873

javax.management.RuntimeOperationsException when register performance mbean using cxf webclient with an operation's uri containing some query params

    XMLWordPrintableJSON

    Details

    • Estimated Complexity:
      Novice

      Description

      I want to monitor my CXF REST service call, then i use the Performance MBean provided by CXF.

      One of my operation use query params :

       
              @GET
              @Path("/documents/{idDocument}")
              @Produces(MediaType.APPLICATION_OCTET_STREAM)
              public Response loadDocument(
                @Context Request request, @HeaderParam("If-Modified-Since") Date date,
                @PathParam("idDocument") String idDocument,
                @QueryParam("loadingType") String loadingType)...
      

      When i call the service's operation like this :

          WebClient.create("http://host/DocumentService").path("/documents/{idDocument}","10").query("loadingType","C").accept("*/*").get(Response.class);
      

      The operation works but in the log we have this stacktrace :

          WARN - Create Counter''s ObjectName failed. {0}
          javax.management.RuntimeOperationsException
              at javax.management.ObjectInstance.<init>(ObjectInstance.java:97)
              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:985)
              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:938)
              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:330)
              at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:516)
              at org.apache.cxf.management.jmx.InstrumentationManagerImpl.registerMBeanWithServer(InstrumentationManagerImpl.java:331)
              at org.apache.cxf.management.jmx.InstrumentationManagerImpl.register(InstrumentationManagerImpl.java:229)
              at org.apache.cxf.management.jmx.InstrumentationManagerImpl.register(InstrumentationManagerImpl.java:246)
              at org.apache.cxf.management.jmx.InstrumentationManagerImpl.register(InstrumentationManagerImpl.java:239)
              at org.apache.cxf.management.counters.CounterRepository.createCounter(CounterRepository.java:117)
              at org.apache.cxf.management.counters.CounterRepository.increaseCounter(CounterRepository.java:93)
              at org.apache.cxf.management.interceptor.AbstractMessageResponseTimeInterceptor.increaseCounter(AbstractMessageResponseTimeInterceptor.java:142)
              at org.apache.cxf.management.interceptor.AbstractMessageResponseTimeInterceptor.endHandlingMessage(AbstractMessageResponseTimeInterceptor.java:74)
              at org.apache.cxf.management.interceptor.ResponseTimeMessageInInterceptor.handleMessage(ResponseTimeMessageInInterceptor.java:39)
              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
              at org.apache.cxf.jaxrs.client.ClientMessageObserver.onMessage(ClientMessageObserver.java:56)
              at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1627)
              at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1494)
              at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1402)
              at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
              at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:649)
              at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
              at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:727)
              at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:678)
              at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:325)
              at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:422)
              ...
          Caused by: java.lang.IllegalArgumentException: Invalid name->org.apache.cxf:bus.id=cxf2071824233,type=Performance.Counter.Client,service="{http://host/DocumentService}WebClient",port="WebClient",operation="GET:http://host/DocumentService/documents/10?loadingType=C"
              at javax.management.ObjectInstance.<init>(ObjectInstance.java:94)...
      

      I understand that the problem is when you use the WebClient to call your REST service. CXF use the URI to register the MBean to monitor the service call. In our case, the URI contains a question mark which is detected as a pattern style for an MBean and the Mbean server avoid creating an MBean with a pattern name.

      Maybe we could replace the question mark by another char.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sergey_beryozkin Sergey Beryozkin
                Reporter:
                guillaumemary Guillaume Mary
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: