The code is simpler if you are running it from the same container within which the beans are being registered.

// If you are running code within the same container as the beans are
// being registered from, it is much easier to get the connection.
MBeanServer mbsvr = MBeanServerFactory.newMBeanServer();
// And the bean name is also much simpler.
ObjectName beanName = new ObjectName(mbsvr.getDefaultDomain() + ":type=BEANTYPE,name=BEANNAME");
// Query an attribute on the MBean.
System.out.println(remote.getAttribute(beanName, "ATTRIBUTENAME"));;