I have three instances of Jboss (dev, test, qa) running varying stages of my application. I'm writing a webapp in which I want to dynamically select one of those environments and, using reflection, invoke an EJB from that environment. Because none of the three environments are actually in this webapp's classpath, the JBossRMIClassLoader (which gets used during the initialContext.lookup() method) doesn't know anything about my specific home interface, so I get ClassNotFoundException on my.ejbHome.
I've tried sub-classing JBossRMIClassLoader so that I could load those classes, but MyJBossRMIClassLoader gets loaded only once - at startup, so I lose the ability to dynamically pick an environment.
Is this possible to do? Is there a better way than what I'm trying?