• 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

Background Compilation of Servlets

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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?
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sumeet, welcome to javaranch.

I'm afraid but your name is not according to the javaranch naming policy, so please change it...
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is possible. However there are restrictions.

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.
 
Sumeet H Singh
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll have to commend you to the documentation for the Tomcat 6.0 system at http://tomcat.apache.org - It's not something I have memorized.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic