JMXServiceURL jmxUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + JMX_SERVER_PORT + "/server");
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
SampleJmxService mbean = new SampleJmxService();
ObjectName mbeanName = new ObjectName(JMX_MBEAN_NAME);
mBeanServer.registerMBean(mbean, mbeanName);
connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(jmxUrl, environment, mBeanServer);