You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Guy Verbist <gu...@prosumersolutions.com> on 2001/09/12 10:53:57 UTC

RE: Problem with loading classes dynamically, new objects can't " see" things in webapp.

Hi again Craig.

> If ProsumerTestTag is being loaded from the class path, it's 
> being loaded
> by the system class loader.
> 
> If CustomTag is being loaded from the web app, it is being 
> loaded from the
> webapp class loader.

Judging by printing out the name of the classloaders being used at various
times, I was beginning to get this impression.

> Classes loaded from the system class loader CANNOT see 
> classes loaded from
> the webapp class loader -- therefore, Tomcat is telling you the truth.
> These restrictions are based on the way class loaders work in Java, so
> there's nothing Tomcat can do about it.

Right, I wasn't aware of this at all.

> Note that any of the following should work:
> * Put CustomTag and ProsumerTestTag both on the classpath
> * Put CustomTag and ProsumerTestTag both in the webapp
> * Put CustomTag on the classpath and ProsumerTestTag in the webapp
>   (webapp class loaders can look "up" the class loader hierarchy)

OK, I've tried your first suggestion, and that works.

Many thanks indeed for your authoritative answer.

Cheers,

Guy