Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Registering a Servlet at runtime

 
Alexey Gor
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranchers,

Is it possible to register a servlet at runtime without specifying it in web.xml? We are using Tomcat 5.5.12... Thank you.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is possible to access servlets that are not specified in web.xml by their classname; the InvokerServlet does this. That mechanism has many drawbacks, and is generally frowned upon, but it does work.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat suports hot deployment, so you could add the servlet to the WAR, including the mapping, and use the management console to redeploy the WAR file. It wouldn't be perfect since it would first unload the application then restart it.
 
dema rogatkin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some servlet containers support legacy type of servlet definition using properties file. I found that convinient for embedded deployment, for example Sharp Zaurus. I believe old versions of Tomcat support this way.
 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David O'Meara:
Tomcat suports hot deployment, so you could add the servlet to the WAR, including the mapping, and use the management console to redeploy the WAR file. It wouldn't be perfect since it would first unload the application then restart it.


hi,
u r saying that tomcat has got hot diploymen..??
but i use tomcat 5.0 i never came thru this. i do thi manually all the time if modif any servlet..
manually means i modify web.xml file and save that file.. so it will redeploy the servlet..
r u sure that tomcat redeploy the files if i change something in the servlet??? imwan without saving the web.xml file ?

please reply soooooon
cinux
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not believe it supports hot deployment of servlet classes, but if you (for example) run from a WAR and then update the WAR file, the application is unloaded and reloaded.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic