tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Charles Huey" <>
Subject refreshing what tomcat has in memory
Date Mon, 05 Jan 2004 16:40:19 GMT
I have a copy of Tomcat both on my dev machine and my production machine.
 I have some code that looks for an image in a given location, and on the
dev machine (which I set up), the code was working fine (the code takes
that image and inserts it in the middle of a larger one that I'm
drawing).  I was wondering why the image wasn't appearing in the picture
I was generating on the production machine (which I didn't set up--that
contractor was around before I got on board and is no longer with us),
and then realized I simply hadn't copied the image over to the
appropriate directory on that computer.  However, when I did copy the
image into the right directory, it still wasn't picking it up, so I
restarted Tomcat using the Win 2000 Server Services explorer.  However,
the small 1 KB image still wasn't being picked up and placed into the
image I was drawing even though the code was the same as on the dev
machine.  I was baffled, and I stopped and started Tomcat a few times and
then it finally started getting picked up!  So then I deleted the image
from the directory, restarted Tomcat, and the image was still being found
even though it wasn't there!  I restarted Tomcat again, and finally it
wasn't being found anymore.  In my code, I'm explicitly specifying that
the image should be searched for in a pretty-hardcoded sort of manner
every single time it's needed, but I'm thinking Tomcat might cache
certain low-level operations in memory (or does Windows do it, perhaps?).
 I'm wondering if Tomcat might have remembered that that image hadn't
been found before, so was returning some sort of empty file (though I
don't think there were any exceptions, b/c I've searched for the expected
println statements in my Tomcat stdout and stderr log files) every time
after that...and if it was just in memory, then maybe stopping Tomcat
from the Windows Services explorer doesn't get rid of Tomcat's stack
memory (maybe Windows maintains that memory until you restart Tomcat,
even it seems like that wouldn't be the behavior you'd expect).  

I've included the code down at the bottom--it's pretty straightforward. 
I'd really like to know, because there have been times when I have tried
to deploy updated JAR files and Tomcat just wouldn't pick them up.  When
a modified JSP isn't being re-compiled, I know to go search for the
genereated Java code and class files in the work directory and delete
them to force re-compilation, but I don't know what to do it to find a
newly modified JAR file!  Or in my other case, a newly "modified" image!  

Thanks for any clarifications!

Here's the code I was referring to:

      String logoLocation = GlobalSettings.getSetting("imagedir") +
      try {
        //Image logo =
        javax.swing.ImageIcon logoIcon = new
        Image logo = logoIcon.getImage();
        //System.out.println("logoLocation is " + logoLocation);
        if (logo == null) System.err.println("logo is null, and toString
        gives "  + logo.toString());
        // Draw image
        boolean drawn = oCanvas.drawImage(logo, 185, 190, null);
        //System.out.println("drawn is " + drawn);
      } catch (Exception e) {
        System.err.println("Unable to find Airborne logo at " +
        logoLocation + ": " + e);

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message