Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with Tomcat caching old pages that it shouldn't

843836Mar 16 2005 — edited Mar 16 2005
Hi,

Here's the thing. I a .class file into my WEB-INF/classes directory, and use it with the following file (counter.jsp):
<html>
<head>
<title>Counter test - Time-stamp: <2005-03-16 11:17:34 dflguest></title>
</head>

<jsp:useBean id="counter" scope="application" class="asfy.Counter" />

<body>
<p>
Counter: ${counter.incAndReturn}
<br />
</p>
</body>

</html>
It works as I'd expect. It displays a message saying "Counter: X", where X is a number that is incremented every time I reload the page. Please note that we shall refer to this output as the "OLD CORRECT PAGE".

However, then I replace the relevant line with:
<jsp:useBean id="counter" scope="application" class="Counter" />
It gives me an error. I don't understand why, since I'm including the 'asfy.*' package above.

But still, that's not my problem. My problem is that when I start reloading my web browsers, some very strange behaviour is apparent:

on the first reload, it shows an error message. Fine, that's what its supposed to, I guess

Then I press reload again. This time, it shows the OLD CORRECT PAGE! Not only that, but it increments the number like its supposed to!

Then I press reload again. Now, it shows the error message. That's good, I suppose.

Then I press reload again between 9-12 times. On each press, it shows the OLD CORRECT PAGE, and the number increments each time!

Then I press reload, and the error page is displayed.

What's going on?

Here's my META-INF/context.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<Context
    reloadable="true"
    workDir="work\Catalina\localhost\_">
  <WatchedResource>WEB-INF/web.xml</WatchedResource>
  <WatchedResource>META-INF/context.xml</WatchedResource>
  <WatchedResource>WEB-INF/web.xml</WatchedResource>
  <WatchedResource>META-INF/context.xml</WatchedResource>
  <WatchedResource>WEB-INF/web.xml</WatchedResource>
  <WatchedResource>META-INF/context.xml</WatchedResource>
</Context>
Its interesting that if I wait 5 seconds between reloads, the error page is displayed every time (like I thought it should.)

What's going on?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 13 2005
Added on Mar 16 2005
13 comments
501 views