-
1. Re: Aspect for replacing Class.forName()?
bill.burke Sep 29, 2004 3:04 PM (in response to duslow)Can you spec this out more? I don't understand what you mean.
Bill -
2. Re: Aspect for replacing Class.forName()?
duslow Sep 29, 2004 8:15 PM (in response to duslow)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 -
3. Re: Aspect for replacing Class.forName()?
duslow Sep 29, 2004 8:17 PM (in response to duslow)(My apologies for a double post .. my last post was cut off)
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 server_target/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 -
4. Re: Aspect for replacing Class.forName()?
bill.burke Sep 30, 2004 9:34 AM (in response to duslow)oh, ok, good idea....
i