[ 
https://issues.apache.org/jira/browse/CXF-4873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sergey Beryozkin resolved CXF-4873.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.5.10
                   2.6.7
                   2.7.4
                   2.8.0
         Assignee: Sergey Beryozkin

Thanks for reporting this issue; I've updated the counter interceptor to escape 
'?', this really affects only WebClient path as '?' is unlikely to/will not 
appear in WS client or indeed in RS proxy client operation names, so for now 
I've just limited the escaping code.

I wonder if the 'query' should be part of the WebClient operation name, in 
principle, this can be reported as another MBean property, but probably makes 
sense to keep it as is for now as technically the query is part of the specific 
application URI. 
                
> 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, 2.7.2
>            Reporter: Guillaume Mary
>            Assignee: Sergey Beryozkin
>              Labels: jmx
>             Fix For: 2.8.0, 2.7.4, 2.6.7, 2.5.10
>
>
> 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)
>         ...
>     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)...
> {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