File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes When web.xml is loaded? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "When web.xml is loaded?" Watch "When web.xml is loaded?" New topic

When web.xml is loaded?

Mauricio Lopes

Joined: Aug 04, 2009
Posts: 12
When Tomcat loads the web.xml file? Only when the first request is made?
What is the container lifecycle, since its start?
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

It will be read at startup. If you make your application reloadable, it will also be read when changes are made to it.

[My Blog]
All roads lead to JavaRanch
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

More accurately, the Tomcat deployer reads, digests, and applies web.xml to build Tomcat-internal app support objects. The application itself doesn't access web.xml, but it's one of 2 deployment descriptors used when a webapp is deployed. Web.xml is the container-independent deployment spec. The other deployment descriptor is container-specific, and in the case of Tomcat, it's the Context definition supplied or synthesized when a webapp is deployed.

Under normal circumstances, all eligible webapps are deployed at server startup and when the webapp WAR or Context definition is changed. Redeploying on a change is optional, but enabled by default. Tomcat scans the webapps at intervals and redeploys eligible webapps, so the redeployment isn't quite instantaneous, but it's a fairly short interval by default.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: When web.xml is loaded?
It's not a secret anymore!