https://bz.apache.org/bugzilla/show_bug.cgi?id=63612

--- Comment #6 from Konstantin Kolinko <knst.koli...@gmail.com> ---
1. If "Thread.currentThread().getContextClassLoader()" is null, it essentially
means that this thread is not associated with a web application.

(Thus it cannot access the classes provided by web application, cannot use log
configuration specific to this web application and so on).


2. ClassLoaderUtil.loadClass(ClassLoaderUtil.java:56) does a loop over an array
of ClassLoaders.

The following line

   throw new ClassNotFoundException("Classloader is null");

just simulates a ClassNotFoundException that is is thrown in the non-null
branch (by the "Class.forName(..)" call) when the class is not found.

3. The TCCL is the last ClassLoader in the array, so there are no more
classloaders to try.


The handling of the null value may be improved, but I see nothing more than
providing a different error message. The result will be the same
ClassNotFoundException.

I guess that this is not what you are looking for.


1. I think that you can avoid this error if you put the database driver into
the same classloader where tomcat-jdbc.jar was loaded from. That is: into the
"lib" directory of Tomcat, like people did in the good old times.

(I guess that you bundled the database driver with you web application.)

2. You would better find the rood cause behind the null TCCL in that thread.

Even if you avoid the driver loading issue, the thread may experience other
oddities. What comes to mind:
- a wrong logging configuration,
- being unable to access JNDI directory.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to