Changed items can be re-loaded on the fly because of dynamic classloading.

Every JSP instance lives in its own classloader. When a jsp source file is changed, the JSP servlet recognizes the change and recompiles the JSP. Once the JSP is translated to a new .java (and .class file) - the class file is read in as a new class under a new classloader and the old classloader is discarded. Because the of the creation and destruction(well ... the absence of referenceing) of classloaders - you can reload the same class (jsp class name) mulitple times in the life of a single JVM instance.

When it comes to servlets - they aren't loaded by an extra classloader. In that case - you need to reload the *entire* webapp which does the above but for all classes/jars in the WEB-INF directory.

The dynamic classloading abilities are (one of)the primary reasons why tomcat ignores the CLASSPATH variable on startup. Because once the system classloader loads a class - its there forever - no dynamic reloading allowed!

For information on classloaders in tomcat:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html

-Tim


naryam naryam wrote:
Hi,
Is it true that each time a java servlet changes the tomcat servlet engine must be restarted. Does it mean that each time we need to recompile, we need also to restart the engine?



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to