cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <>
Subject Re: Expose MBeans in CXF
Date Thu, 19 May 2011 09:20:19 GMT
HI Shenglin

>> String href = builder.path("mbean").path(someUniqueKey).build().toString()
> Here is my progress, I use  UriBuilder uriBuilder =
> uriInfo.getAbsolutePathBuilder().path(this.getClass(), "list"); and
>             String uniqueKey = Integer.toString(index++);
>              String href = uriBuilder.path(uniqueKey).build().toString();
> in each MBean.
> (Actually, the result is something I never studied before. This is a very
> interesting topic. I will spend more time on it.)

Indeed, it's interesting.

You actually need to use uriInfo.getBaseUriBuilder() instead and add
"mbean" segment followed by some
unikey key. Using uriInfo.getBaseUriBuilder() will make sure that
irrespectively of whether you have a /list or /service/* or /type/*
query, you will alway get the same result for MBean href.

More comments below.

> My current response on this url: http://localhost:8080/services/jmx/

> <MBeans>

>    <MBean href="http://localhost:8080/services/jmx/list/0/1/2/3/4/5">
>       <attribute>
>          <type>MBeanServerDelegate</type>
>       </attribute>
> <canonicalName>JMImplementation:type=MBeanServerDelegate</canonicalName>
>       <domain>JMImplementation</domain>
>    </MBean>

MBeans which are not in the org.apace.cxf domain have to be dropped.
We can have the name of the domain injected as a property in the
future. At the moment have a 'final String DOMAIN_NAME' constant and
use it to filter  out non-CXF MBeans

The other note is that it should always be
with the key being 1, 2, or something more descriptive which can
uniquely identify a given MBean. You probably need to keep a
ConcurrentHashMap, where keys are 1, 2, and values are canonical
names, something like that, so that when you get a request like
"http://localhost:8080/services/jmx/mbean/1" you can retrieve the
corresponding Object name and do something with it

>    <MBean href="http://localhost:8080/services/jmx/list/0/1">
>       <attribute>
>          <busId>cxf33425430</busId>
>          <port>"JMXServer"</port>
>          <service>"{}JMXServer"</service>
>          <type>Bus.Service.Endpoint</type>
>       </attribute>
> <canonicalName>,port="JMXServer",service="{}JMXServer",type=Bus.Service.Endpoint</canonicalName>
>       <domain>org.apache.cxf</domain>
>    </MBean>

This bean has to be excluded as well, at least by default.
What you can do in the short term is to qualify the jmx server
endpoint like this:
<jaxrs:server xmlns:s=""
serviceName="s:JMXServer" address="/jmx">
<property name="serviceName" value="{}JMXServer"/>

This will give you enough info for checking MBeans which have
'service' attribute and blocking the one which matches this
serviceName. Another solution is use jaxrs:property or jaxws:property
to indicate that a given endpoint should not be JMX-exposed and update
InstrumnetationManager to check such a property - perhaps we can do it

> Of course, as you required, I format the output.

Sorry, I may've confused you, please don't format,

thanks, Sergey

> Regards:
> Shenglin Qiu

View raw message