I have a custom server that I run in JBoss within an MBean. This server needs to dynamically initialise certain objects seperate from the main core of the custom server.
I tried to load these classes with using standard Class.forName(..) type stuff but I kept getting class loader errors when running within JBoss (3.2.6).
How should I go about dynamically loading classes within an Mbean? The classes are likely to be bundled within different .jar files inside the MBean directory. Could I use the SPI, service provide interface? or if there a better method I should use. Any suggestions would be much appreciated as I'm not really sure what is the most "JBoss" way of solving this problem.
All right, this question comes up every so often, so I wrote an FAQ:
as part of the FAQJBossJMX: