First, I believe you must package your third-party or custom classes into .jar files (you cannot put .class files directly in the plugin's lib directory).
To learn how to use the additional class path entries property, see these:
Because your service is injected directly in a JBossAS server, I'm wondering if we'll need to do something extra. The connection properties that you use to connect to JBossAS are different than those when connecting to a generic VM. I'm thinking we might need to add the ability to add additional classpath entries to JBossAS connection properties. Its late and I can't think straight :) read those URLs above and see if you can do the same. I'm not sure if you can tell the JBoss plugin to add arbitrary jars to the classpath of the EMS connection today, but if you can't it shouldn't be hard to add another plugin-configuration simple-property to the jboss plugin rhq-plugin.xml descriptor to enable this.
Thanks for your quick reply, Mazz.
So far there is no code to handle adding classpath entry to EMSconnection in jboss plugin, so it looks like we can not enable it by adding a simple-property in rhq-plugin.xml .
When we add the adding classpath entry function to jboss plugin , how can we enable EMSConnection to load a class in a nested jar (in the custom jar file packaged in plugin) ? At present whether ChilldFirstClassLoader or URLClassLoader working with EmsConnection can not load this kind of class . Is it possible to set the current plugin classloader to EmsConnection dynamically before retrieve the MyValue object through jmx?
If you need custom connection properties and classes you can build your own EMS connection rather than trying to use the parent plugin component's. You should be able to use the AS plugin as an example of how to do that.
After connectionFactory.discoverServerClasses is run you can add jar paths to the ConnectionSettings classPathEntries