Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Registering Servlets in web.xml dynamically at runtime  RSS feed

 
Sanjay Ra
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Is it possible to register new serlvet names with the same servlet class at runtime of Tomcat as opposed to at startup?

thanks
Sanjay
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36432
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sanjay,
No. At minimum you need to restart the app.
 
Sanjay Ra
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you mean i would need to restart tomcat?

thanks
Sanjay
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you would need to restart the app.
See the documentation for the Manager App that ships with Tomcat.
 
Sanjay Ra
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

The issue i have here is just a servlet but i want to register new servlet with the same servlet class
So when i start up i have serlvet 1, servlet 2 but want to add serlvet 3 at runtime all using the same servlet class
So what is it that needs restarting here?

thanks
Sanjay
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order to get the servlet engine to re-read web.xml you have to restart the web application - this can be done with the Manager App - choose the restart option, (not stop followed by start since this does not appear to reload web.xml)
Bill
 
Sanjay Ra
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks William,

Does adding a new Application involve restart of the Tomcat engine ?
Can i get around the restart by just making the new serlvet as a new Application as opposed to just updating the web.xml? Will the other applciations get affected by adding this new application

thanks
Sanjay
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what do you actually want, a new servlet or a new application?

No other applications wouldn't be affected from that newly added application. And yes you probably have to restart the tomcat in case of a new application.

thanks.
[ January 28, 2005: Message edited by: Adeel Ansari ]
 
Sanjay Ra
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to register a new serlvet using an exisitng serlvet class but do so without restarting the whole tomcat or affecting other running serlvets.
So the way to do this is to add another application through the tomcat Manager App ?

thanks
Sanjay
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you read and understood any of the responses?
What you want can NOT be done.
 
Rema Remulta
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sanjay,
1. If you just like to register a new servlet class in the web.xml of your web app, you must have to restart only this web app and without having to restart the other apps since each web app has its own web.xml.
2. If you want to add a new app on tomcat, you must have to restart your tomcat engine for this new app to load.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not anymore Rema. There are now mechanisms to deploy webapps without server restart.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!