tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martijn Koster <>
Subject Re: Servlet Re-loading in TC4
Date Tue, 01 May 2001 12:59:39 GMT
On Tue, May 01, 2001 at 11:41:00AM +0100, Kevin Jones wrote:

> The log says
> StandardLoader[/AddressBook]: Reloading checks are enabled for this Context
> but re-loading doesn't (appear) to work.

Same problem here. The mailing list archives show others experience it
too. I've appended a test which shows what's going on with the
HelloWorld example.

The StandardClassLoader.findClass successfully loaded the servlet
class from a "jndi:" URL, and then tried to convert that to a File so
it can track modification dates. That file can't be found, and is
therefore not cached, and therefore not tracked by modified(). You
can't just convert a JNDI to a File pathname like that, AFAIK.

It seems to me that to support reloading StandardClassLoader should
either use URLs and URLConnections only to load classes and track
modification dates (not explicit File's), or else that the jndi URL
should somehow be resolved into a file URL. At the very least
findClass() could spot non-file URLs and not bother to do the File
conversion, and instead log the fact that this repository cannot be
tracked for modification to reduce recurring confusion.

But being completely new to Tomcat I may be completely off the mark,
and certainly won't claim to know the right solution. :-) Can anyone
enlighten us?

-- Martijn

Apply this patch:

RCS file: /home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/,v
retrieving revision 1.15
diff -u -r1.15
---	2001/04/25 04:14:47	1.15
+++	2001/05/01 08:30:59
@@ -265,7 +265,7 @@
      * The debugging detail level of this component.
-    protected int debug = 0;
+    protected int debug = 5;
@@ -695,6 +695,9 @@
                 name.replace('.', File.separatorChar) + ".class";
 	    try {
                 File file = new File(pathname);
+                if (debug >= 5)
+                    log("      Checking file " + pathname +
+                        " absolute path " + file.getAbsolutePath());
                 if (file.exists() && file.canRead()) {
                     if (debug >= 3)
                         log("    Caching from '" + file.getAbsolutePath() +

Then rebuild, do a:

  GET http://localhost:8080/examples/servlet/HelloWorldExample

and observe:

StandardClassLoader:   Loading class from parent
StandardClassLoader:       Checking repository jndi:/localhost/examples/WEB-INF/classes
StandardClassLoader:       Checking file jndi:/localhost/examples/WEB-INF/classes/HelloWorldExample.class
absolute path /home/sss/tomcat-test/jndi:/localhost/examples/WEB-INF/classes/HelloWorldExample.class
StandardClassLoader:       Returning class class HelloWorldExample
StandardClassLoader:       Loaded by StandardClassLoader

View raw message