public class TreeWalker {
private static final Logger log = LoggerFactory.getLogger(TreeWalker.class);
public static void main(String[] args) throws Exception {
Server server = Server.builder().setHost("localhost").setPort("1099").build();
JMXConnector conn = null;
try {
conn = server.getServerConnection();
MBeanServerConnection mbeanServer = conn.getMBeanServerConnection();
TreeWalker tw = new TreeWalker();
tw.walkTree(mbeanServer);
} catch (IOException e) {
log.error("Problem processing queries for server: " + server.getHost() + ":" + server.getPort(), e);
} finally {
if (conn != null) {
conn.close();
}
}