Had a doubt regarding the re-compilation of a servlet after server start-up. If JSPs can be recompiled after they have been changed (after the deployment and server start-up) and their changes are reflected, why is it so that the same is not possible for servlets considering the fact that JSPs are also converted to servlets later?
First, your webserver has to support dynamic class updating. Secondly, that feature has to be switched on. Tomcat manages updated classes by periodically polling for changes, which is extra overhead. So if you want reduced overhead, you'd disable it. Also, it polls fairly infrequently, so it can take a minute or so for the updated class to be seen.
My current system actually stops and restarts the entire webapp when a class changes, but it's not reliable. I've seen issues with servlets because the init() method wasn't called again after the new version of the class loaded, also.
It's not just servlets that can be replaced on the fly. Any Java class can be updated in a live webapp if the appserver supports it.
Customer surveys are for companies who didn't pay proper attention to begin with.
Sumeet H Singh
Joined: Jan 03, 2009
Thanks Tim for the detailed reply...
Can you please also specify how to switch-on the facility for Dynamic Class Loading in Apache Tomcat 6.0 ?