JMX Newbie class loading question.
Hi I'm new-ish to JMX so I thought that this forum would be a good place to post this question.
I'm attempting to build a modular system using JMX, where the MBean server is started using a main(args[]) class.
My aim is to put all the custom mbeans in separate JAR files (in alib folder) that are loaded in by using URL classloaders.
The problem I'm having is with class loading.
My systems system starts something like this:
(1) The Main.java class reads in the command line parameters (it's started from a windows .BAT file)
(2) The Main.java class creates a ServerConfig object which contains all the command line params and additional configuration information
(3) I then create ServerBuilder object which reads in all the params from the ServerConfig.
The ServerBuilder object creates a new URLClassLoader which is used to create a Server object
(4) In the Server object i create the MBean Server using:
MBeanServerFactory.createMBeanServer(String name)
I then add some startup standard MBeans using server.registerMBean() whcih works fine! These objects are already instances in within the Server object
However when I make a call to server.createMBean(classname, null) i get the annoying error (the MBean implements the MBeanRegistration interface and methods):
java.lang.RuntimeException: javax.management.ReflectionException: The MBeanclass could not be loaded by thedefault loader repository
The MBean i'm trying to register is in a separate JAR file that is loaded in by the URLClassloader in ServerBuilder.
I'm using JDK1.5.0_08 and using the built in Sun JMX.
Could anyone please help with the following questions?
(1) How does class loading work in the MBeanServer?
(2) Why can I create an instance of the MBean but the MBeanServer cannot?
(3) Is there any way to find out what the classloader is referencing for the MBeanServer instance?
(4) How can you set the class loaders for a specific MBeanServer?
Phew...
Thanks
Martin
Could anyone please explain to me why the MBean server cannot see the

