Guillaume Mary created CXF-4873:
-----------------------------------

             Summary: javax.management.RuntimeOperationsException when register 
performance mbean using cxf webclient with an operation's uri containing some 
query params
                 Key: CXF-4873
                 URL: https://issues.apache.org/jira/browse/CXF-4873
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 2.5.2
            Reporter: Guillaume Mary


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 :

{code:java} 
        @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)...
{code}

When i call the service's operation like this :

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

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

{code:java}
    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)
        at 
fr.gouv.interieur.faeton.common.ws.facade.impl.FacadeRestImpl.callServiceOperation(FacadeRestImpl.java:138)
        at 
fr.gouv.interieur.faeton.common.ws.facade.impl.FacadeRestImpl.callServiceOperation(FacadeRestImpl.java:24)
        at 
fr.gouv.interieur.faeton.common.ws.facade.impl.AbstractFacade.appelerWebService(AbstractFacade.java:256)
        at 
fr.gouv.interieur.faeton.common.ws.facade.impl.DocumentServiceRestFacadeImpl.chargerDocument(DocumentServiceRestFacadeImpl.java:288)
        at 
fr.gouv.interieur.faeton.common.map.filtre.DocumentFiltre.doFilter(DocumentFiltre.java:129)
        at 
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
        at 
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
fr.gouv.interieur.faeton.ct.hab.filtre.HabilitationFiltre.doFilter(HabilitationFiltre.java:123)
        at 
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
        at 
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
fr.gouv.interieur.faeton.ct.identification.filtre.IdentificationFiltre.doFilter(IdentificationFiltre.java:139)
        at 
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
        at 
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at
 java.lang.Thread.run(Thread.java:636)
    Caused by: java.lang.IllegalArgumentException: Invalid 
name->org.apache.cxf:bus.id=cxf2071824233,type=Performance.Counter.Client,service="{http://10.24.88.53:8095/mas-doc/DocumentService}WebClient",port="WebClient",operation="GET:http://host/DocumentService/documents/10?loadingType=C";
        at javax.management.ObjectInstance.<init>(ObjectInstance.java:94)...
{code}

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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to