I'm not sure whether it's right way but maybe it could be possible to fetch it from a mBean.
Whether I found correct one then it could be something like:
ObjectName on = new ObjectName("JMImplementation:type=MBeanServerDelegate");
Object attr = server.getAttribute(on, "MBeanServerId");