In order to support allowing JMX plugin to connect and monitor arbitrary JVMs/resources, we need to be able to tell the EMS connection to add additional classpath entries. For example, in order to connect and monitor Hibernate statistics, we need the tell EMS to not only connect to the hibernate JVM, we must also tell it where it can find the hibernate classes that will be returned by the hibernate statistics MBean (like the query stats object). Suggest we add a new plugin config option in which you can specify one or more jars and/or directories containing jars. The EMS connection will then be given the names of all the jars found (ie. they will be added to the EMS connections classpath entries).
I'll add this to the JMX Server resource type's plugin configuration: <c:simple-property name="additionalClassPathEntries" required="false" type="string" description="Comma-separated list of directories and filenames that contain resources and classes needed to communicate with the JMX Server and its MBeans. If you specify 'some/directory/*.jar', all jars found in the given directory will be added."/> EMS provides the ability to add class path entries of either directories or .jar filenames. Here, we allow you to specify 0, 1 or more .jar filenames, directory names (for location of resources like .xml or .properties files needed by the connection) or directory/*.jar (as the description indicates, this is where you can convienently add all jar files found in 'directory').
Verified this worked. I was able to auto-discovery a running, standlone J2SE app with hibernate running inside it. I used this new plugin config setting to tell EMS where it can find the hibernate jars and was able to successfully execute hibernate plugin operations and collect hibernate stats.
All you need to test this is to look at or create any JMX Server resource (you can do a manual create if you'd like). Go to that server resource's inventory tab and confirm you see the new "additionalClassPathEntries" plugin configuration setting. Optionally, to test this actually actually works you can do the stuff this demo did: http://management-platform.blogspot.com/2008/11/monitoring-hibernate.html
I used mazz's helloworld.jar (see rhq-1600 ) to test these hibernate entities, all worked as expected. Could see the inventory items, metrics, etc. rev3078
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-1094 This bug incorporates RHQ-1001