• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

servlet not reloading on Tomcat 4.0

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wrote a simple Hello World servlet , compiled it and had it working on the web browser, so far so good. Next I changed the servlet, recompiled it and clicked on the Refresh button on the browser, nothing, no change.
I have to shut down and restart the standalone Tomcat Apache engine each time I recompile the servlet, it is very tedious.
Someone please help.
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've closed the previous thread, but for the future, either start a new thread right away if you are talking about a new problem, or just stick with the old one.

for reference: http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=56&t=000205
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using:
Tomcat 4.0.1
Windows 2000 Pro, SP2
IE 5.5

Here is my directory structure:

In server.xml, the only addition I've made is a test Context element between the manager context and the examples context:

In my web.xml under my webapp's WEB-INF directory, I have: Finally, my servlet code is:
Starting Tomcat, and hitting the URL: http://localhost:8080/test/hello produces a page titled "Hello World!" with "Hello World!" in Big letters.

Going back to my servlet, and uncommenting the Small Change line, recompiling, and refreshing my browser, and I see a different page.. one that has "Small Change" right underneath Hello World.

The very first time I did this, I had to hold down the Shift key while I clicked on Refresh. For each subsequent change, (I put on "change 2, change 3, etc, etc...), a single click on the refresh seemed to work.

There are no 'special' considerations to be made. Just make sure you have the 'reloadable' attribute in your Context element set to true, and you should be fine. I had previously thought this was a default value, but I've tried it out, and it doesn't appear to work.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've played around some more...

SOMETIMES, it will work if you use *just* the DefaultContext element, with reloadable=true. Other times, it will not.
SOMETIMES, it will work with the DefaultContext, with reloadable=true, AND a test Context (missing a reloadable attribute). Other times it will not, or is SLOW to recognize the change.

BUT... I cannot get it to behave badly if I have the reloadable=true set into the test context. So I think the bottom line here is, make sure you make a context for each webapp, and explicity set it's reloadable attribute = true. Don't rely on the automatic DefaultContext (or even the automatic 'creation' of contexts from directory structures in webapps).

And after all that, I'm sure other people have different experiences using Tomcat on their machines. Oh, the joy of software development.
[ February 14, 2002: Message edited by: Mike Curwen ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic