Hi, I have some utility classes in $tomcat/shared/lib directory, which are used by several webapps. These need to be initialized before any of my webapps are called by the client. One of these shared classes gets a reference to its class loader, by calling Thread.currentThread().getContextClassLoader().
I understand that in Tomcat, there are separate class loaders for shared/libclasses and webapp classes (and they have a parent-child relation). Now, if this shared class is initialized from any of my webapps (say, using contextInitialized()), the Thread.getContextClassLoader() method returns the webapp class loader, instead of the shared/lib class loader. How do I get the correct class loader? As far as I understand, one way to achieve this would be if Tomcat provides a hook that can be invoked while it starts up (something similar to Runtime.addShutdownHook()). Basically, I am looking for a way to force the shared/lib class loader to load the classes before any of the my webapps are initialized. Regards