One example is what Adrian wrote about in this thread 
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=50041Class.forName() 

The important snippet is ..

"You should always use Thread.currentThread().getContextClassLoader().loadClass() 
which avoids Sun's broken caching.

But I have never seen this not load a class, only load an old class giving you a 
variant of ClassCastException."

I've had similiar issues when bundling 3rd party JDBC drivers in, for example, an ear 
file.  The typical workaround for the problems caused by with 
Class.forName("SomeClass") is to put the jar in the /lib directory instead of the ear.

I was just thinking that it would be helpful (especially with closed source 3rd party 
libs) to have a default JBoss Aspect that could be turned on to automatically replace 
Class.forName("SomeClass") with 
Thread.currentThread().getContextClassLoader().loadClass("SomeClass").

Dustin



View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3849939#3849939

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3849939


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to