[jboss-dev-forums] [Design of JBoss ESB] - Class.forName() vs. Thread.currentThread().getContextClassLo
bill.burke@jboss.com
do-not-reply at jboss.com
Fri Mar 16 00:28:29 EDT 2007
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
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4028665#4028665
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4028665
More information about the jboss-dev-forums
mailing list