Application Server Solutions for Microsoft IIS and ASP.NET
       solutions   products   partners   company   support   downloads         store
ServletExec Self-Help: FAQ
Back to Search >  Back to Search Results

Faq ID 104
Product ServletExec
Category Class Loading/Reloading
Question I do not fully understand all aspects of how ServletExec reloads class files. Can you please explain it in great detail?
Answer For servlets that ARE part of a Web Application:
  • With ServletExec, each Web Application uses its own single custom classloader to load servlets into the JVM as they are invoked. Newer versions of Servlets are NOT reloaded automatically (the way that they are outside a Web app, in the "Servlets" folder) however a user can tell ServletExec to throw away that custom loader (thus unloading from the JVM all classes that had been loaded by that custom classloader). This is accomplished by reloading the Web Application from the main SE Admin UI dynamically. Then when the new versions are invoked they get loaded into the JVM. This way the reloading of all classes inside a web application is a controlled, user-defined function. This is in contrast to some other Servlet/JSP engines which take a "side-effect" approach and automatically (behind the scenes), reload all loaded classes in a web app even if just one of them was changed.

For servlets that are NOT part of a Web Application (a.k.a. Legacy Servlets):
  • If the servlet DOES reside in the folder that has been designated as the "Servlets" folder (on the configuration page for that ServletExec Virtual Server) then when it is invoked, it gets loaded into the JVM by a ServletExec-controlled Custom Classloader. If that servlet is then modified/recompiled (thus changing its last-modified timestamp on the hard drive) ServletExec recognizes this the next time it is requested and throws away the custom classloader that was originally used to load it. SE then gets a new Custom classloader to load the new version into the JVM (automatic reload of a servlet). This will only occur for classes in the Servlets folder that actually extend HttpServlet. Most servlet/JSP Engines generally have one special folder that is designated to be the "Servlets" folder. Servlets that reside there get loaded by a custom classloader, which is thrown away when newer servlet class files must be loaded. However, if you have a servlet that is already loaded in the JVM and that servlet creates instances of other helper objects, and you change the class file for 1 or more helper objects but do not change the class file for the servlet then the servlet will retain the references to the original helper objects for as long as the servlet remains loaded.
  • If the servlet does NOT reside in the folder that has been designated as the "Servlets" folder then when invoked, it is loaded into the JVM by the System classloader. ServletExec cannot control this classloader and thus cannot throw it away and get a new one. For this reason, classes that have been loaded into the JVM by the System classloader, stay in the JVM until the JVM is stopped and restarted (reinitialize ServletExec).

For JSPs:
  • Regardless of whether a JSP is executing inside the context of a Web Application or outside the context of a Web Application, the newest version of a requested JSP will be used. If you have a JSP that includes another JSP (or uses a helper object or a JavaBean) and you make a change to the included JSP (or the helper object or the JavaBean), you won?t see the change on the next invocation unless you also make a change (touch) the including JSP.

company media information terms of use privacy policy contact us