Trying to connect to a MBean in a remote VM with the following script:
causes the following error when instantiating the GroovyMBean:
After doing some investigation I discovered that this is a class loader problem. The constructor does exist, but the MBeanServerConnection returned by JMX is loaded by the root class loader from rt.jar while Groovy looks for the MBeanServerConnection loaded by the groovy class loader from mx4j.jar. This can be confirmed by deleting mx4j.jar, which solves the problem.
The more general problem here is the coexistence of the same class from two classloaders. Maybe the groovy class loader should first delegate to the bootstrap class loader. But I don't know internal details, so this might not make senss.