> A "mmbase/src/org$ grep -r 'Class.forName(' * " will return a lot of
> classes which are instanciated by the Bootstrap classloader.

According to the javadoc, Class.forName(classname):

"Returns the Class object associated with the class or interface with the
given string name. Invoking this method is equivalent to:  Class.forName(className, 
true, currentLoader)
where currentLoader denotes the defining class loader of the current class."

So when called from mmbase classes, the classloader used is the webapp
classloader (instead of the bootstrap classloader). This is correct
behaviour.
> Should these Class.forName(); methods be replaced by
> getClass().forName(); methods, so that they will use the current
> classloader for loading their new classes?

No. Method getClass() is called on an instance of the class, so it
requires the class to be loaded allready.
Rob van Maris
Developer

Finalist IT Group
Java Specialists
-------------------------------------------------------------
Amsterdam, The Netherlands
Office: +31 20 5962321 (Direct)
Mobile: +31 651444006
Fax:    +31 20 5962331
-------------------------------------------------------------




Reply via email to