It looks like you want to register an MBean in a remote MBeanServer. First of all, the mBean needs to be serializable to be sent across the wire, secondly, mBeans usually reflect the states of the application resource, and this mBean will need to have some pointer back to your client JVM to gather status. Thirdly and probably the most important of all, is that mBeanServerConnection doesn't have a "registerMbean" method at all, and probably for good reasons. See if this article would be any help to you:
https://blogs.oracle.com/jmxetc/entry/do_not_do_this_but Thanks! On Tue, Sep 13, 2016 at 4:06 PM, Jun Aoki <ja...@pivotal.io> wrote: > Hi Geode community, > > We have a use case where we would like a client side JVM to register Mbean > and federated by JMX Manager on a locator. (As a result, jconsole that > connects to JMX Manager can see what's happening on the client JVM that > "connects" to the cluster. We do so currently ClientCache [1]) > We are referring > https://cwiki.apache.org/confluence/display/GEODE/Creating+Custom+MXBean > and are able to get MBean on a *GF Server* federated. > But we would like to do the same with MBean on a client JVM. > > We are assuming that if we can get a cache of server (not ClientCache) then > we can pass it to ManagementService([2]just like the doc said) but we don't > know how to get a server Cache instance on a client JVM. > > This might be an unpolished question but could you please let us know if we > are thinking right way and / or how we can achieve it? > > > [1] This is how we get "connected" through ClientCache to the GF cluster. > Region region = clientCache.createClientRegionFactory(" > PROXY").create(REGION > ) > > > [2] This is what the doc says and it works for us on server side. > ManagementService service = ManagementService.getManagementService(cache); > // where the cache is Cache instance) > service.registerMBean(bean, beanName); > service.federate(beanName, CustomMXBean.class, false); > > > -- > Thank you, > - jun > > *Pivotal* > -- Cheers Jinmei