You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Julien, Timothy" <TJ...@Bluestone.com> on 2000/10/19 20:18:50 UTC

custom classloaders and web-apps

Suppose i have a custom classloader for my web-app.
The basic problem I can't seem to resolve is:
1. A servlet in the web-app loads a ResourceBundle:
ResourceBundle rb = ResourceBundle.getBundle("MyResources", locale);

Now, the ResoureBundle class will be loaded from the bootstrap classloader,
because the custom  (web-app specific)classloader looks there first.

2. The ResourceBundle getBundle() method looks for
"MyResources+locale.toString()" (or something very similar) in the
classpath.  Now, because ResourceBundle was loaded from the bootstrap
classloader, the class loader that is used to locate
"MyResources_local.toString()" is the bootstap one - which does NOT have the
class (or properties file) - THAT is app-specific.

So custom resource bundles won't be found.

Does anyone now how to get around this basic problem of child classloaders
somehow 'getting control' back, once a class has been loaded from the parent
classloader?

-Tim Julien