From tomcat-user-return-47301-apmail-jakarta-tomcat-user-archive=jakarta.apache.org@jakarta.apache.org Tue Sep 11 22:03:01 2001 Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 39598 invoked by uid 500); 11 Sep 2001 22:03:01 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: tomcat-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 39582 invoked from network); 11 Sep 2001 22:03:00 -0000 Date: Wed, 12 Sep 2001 08:02:47 +1000 From: Dmitri Colebatch X-Sender: dim@localhost.localdomain To: "'tomcat-user@jakarta.apache.org'" Subject: RE: Problem with loading classes dynamically, new objects can't " see" things in webapp. In-Reply-To: <20010911085100.Q36687-100000@localhost> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Tue, 11 Sep 2001, Craig R. McClanahan wrote: > 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. > > 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. > > 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 - this is highlighting my lack of knowledge on classloaders - so hopefully I can learn something here. This is the same thing that causes an issue with struts: using struts, and jboss with embedded tomcat. if the struts.jar is in the jboss/lib/ext (command classpath) then it cannot find form or action classes that are in the web application. I assume this is due to code along the lines of Class.getClassLoader() - now what I dont understand is why those lines of code are not Thread.currentThread().getContextClassLoader() . would that not solve both of these problems - it seems to be a more "embeddable" approach, letting another container (be it jspc, or jboss) control the system. look forward to hearing thoughts on this. cheers dim