4 Replies Latest reply on Mar 16, 2007 6:33 AM by kconner

    Class.forName() vs. Thread.currentThread().getContextClassLo

    bill.burke

      Please do not ever use Class.forName() in any of your code, but instead use Thread.currentThread().getContextClassLoader().loadClass().


      Reason? The reason is scoped classloaders. Class.forName() will use the calling class's classloader. So, if your code resides in a jbossesb.jar someplace, your code will use the ESB server's (JBoss) classloader, rather than the scoped one of your ESB deployment. For example, if your actions are deployed in a scoped .esb file, then it will not run.

      Bill