Hi Sergey
I have now having this response as you commented: <MBeans> <MBean href="http://localhost:8080/services/jmx/list/mbean/0/mbean/1/mbean/2/mbean/3/mbean/4"> <attribute> <busId>cxf29162475</busId> <port>"SoapPort"</port> <service>"{http://org.apache.gsoc.server/Greeter_Soap}SOAPService"</service> <type>Bus.Service.Endpoint</type> </attribute> <canonicalName>org.apache.cxf:bus.id=cxf29162475,port="SoapPort",service="{http://org.apache.gsoc.server/Greeter_Soap}SOAPService",type=Bus.Service.Endpoint</canonicalName> <domain>org.apache.cxf</domain> </MBean> <MBean href="http://localhost:8080/services/jmx/list/mbean/0/mbean/1/mbean/2/mbean/3"> <attribute> <busId>cxf29162475</busId> <port>"CustomerServiceImpl"</port> <service>"{http://server.gsoc.apache.org/}CustomerServiceImpl"</service> <type>Bus.Service.Endpoint</type> </attribute> <canonicalName>org.apache.cxf:bus.id=cxf29162475,port="CustomerServiceImpl",service="{http://server.gsoc.apache.org/}CustomerServiceImpl",type=Bus.Service.Endpoint</canonicalName> <domain>org.apache.cxf</domain> </MBean> <MBean href="http://localhost:8080/services/jmx/list/mbean/0/mbean/1"> <attribute> <busId>cxf29162475</busId> <port>"UserServiceImpl"</port> <service>"{http://server.gsoc.apache.org/}UserServiceImpl"</service> <type>Bus.Service.Endpoint</type> </attribute> <canonicalName>org.apache.cxf:bus.id=cxf29162475,port="UserServiceImpl",service="{http://server.gsoc.apache.org/}UserServiceImpl",type=Bus.Service.Endpoint</canonicalName> <domain>org.apache.cxf</domain> </MBean> </MBeans> Because there are 2 unrelated MBean filtered out, http://localhost:8080/services/jmx/list/mbean/0 -> CXF BUS http://localhost:8080/services/jmx/list/mbean/0/mbean/1/mbean/2 -> My own jaxrs mbean server as you mentioned it must be filtered and also , this is filtered out as you mentioned > > <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> therefore, now href is somehow not continuous as followed, is it ok just for a unique identifier for the MBean we want? http://localhost:8080/services/jmx/list/mbean/0/mbean/1 -> restful UserService http://localhost:8080/services/jmx/list/mbean/0/mbean/1/mbean/2/mbean/3 -> restful CustomerService http://localhost:8080/services/jmx/list/mbean/0/mbean/1/mbean/2/mbean/3/mbean/4 -> soap Greeter Thank you. Regards: Shenglin Qiu > Date: Thu, 19 May 2011 10:20:19 +0100 > Subject: Re: Expose MBeans in CXF > From: sberyoz...@gmail.com > To: dabaip...@hotmail.com > CC: dev@cxf.apache.org > > 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 > "http://localhost:8080/services/jmx/mbean/{someuniquekey}" > 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>"{http://server.gsoc.apache.org/}JMXServer"</service> > > <type>Bus.Service.Endpoint</type> > > </attribute> > > > > <canonicalName>org.apache.cxf:bus.id=cxf33425430,port="JMXServer",service="{http://server.gsoc.apache.org/}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="http://cxf.apache.org/jmx" > serviceName="s:JMXServer" address="/jmx"> > <property name="serviceName" value="{http://cxf.apache.org/jmx}JMXServer"/> > </jaxrs:server> > > 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 > later > > > > > Of course, as you required, I format the output. > > Sorry, I may've confused you, please don't format, > > thanks, Sergey > > > > > Regards: > > Shenglin Qiu > > > >