File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Doubt" Watch "Doubt" New topic


Raj Neets
Ranch Hand

Joined: Nov 12, 2002
Posts: 46
Iam working with tomcat(in Unix environment),my web server is not loading the .class file once i compile,so every time i compile, i have to restart my webserver. i have my class file and java file in webapps/ROOT/WEB_INF/classes.i don't know whether it takes time or i have to do something to get the .class file automatically loaded.
Thank for your time.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

This is a typical problem.
Being able to dynamically reload classes is the exception rather than the normal behaviour, so Yes, you do have to restart every time you change a class file.
You'd find the same thing if you were designing a Swing application. If you start the application, access a class and then alter and recompile the class, you won't see the changes without restarting the application.
This expectation has been created (I believe) by the dynamic reloading of JSPs. This is a longer topic than I have time to write right now
rohit poduval

Joined: Oct 13, 2001
Posts: 6
How about writing your own dynamic class loader.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Um, yeah, right.
The other option that is available if your server supports it and you have written your code properly, is the ability to restart invividual web applications.
This is only one step better, but if you have a heavy server (eg WebSphere) running multiple web applications, this is definitely preferable.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Tomcat supports reloading individual applications. Since 4.1.12, there is a manager application that you can use to reload a web app, and since I forget when, you can specify the application as 'reloadable' in the server.xml config file.

This is not hard stuff, though some people have had flakey behaviour with reloadable, I think this has mostly been addressed in later releases.
I agree. Here's the link:
subject: Doubt
It's not a secret anymore!