This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Background Compilation of Servlets

 
Sumeet H Singh
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • 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?
 
Ankit Garg
Sheriff
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • 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...
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic