Questions tagged [web.xml]

The web.xml is the web deployment descriptor file of Java Servlet based web applications. It allows you to define, declare and configure the Servlet API based implementations in your web application, such as servlets, filters and listeners.

A deployment descriptor (DD) refers to a configuration file for an artifact that is deployed to some container/engine.

In the Java Platform, Enterprise Edition, a deployment descriptor describes how a component, module or application (such as a web application or enterprise application) should be deployed. It directs a deployment tool to deploy a module or application with specific container options, security settings and describes specific configuration requirements. XML is used for the syntax of these deployment descriptor files.

For web applications, the deployment descriptor must be called web.xml and must reside in the WEB-INF directory in the web application root.

Further Reading:

2074 questions
51
votes
3 answers

Can anyone explain servlet mapping?

I'm trying to write a web application using SpringMVC. Normally I'd just map some made-up file extension to Spring's front controller and live happily, but this time I'm going for REST-like URLs, with no file-name extensions. Mapping everything…
agnul
  • 12,608
  • 14
  • 63
  • 85
49
votes
21 answers

SEVERE: ContainerBase.addChild: start:org.apache.catalina.LifecycleException: Failed to start error

I encountered this error when I tried to run my application in Tomcat. I already checked the version of tomcat and java home. Both use java 6. Is there a missing jar? Or is it my web xml? I'm not using any maven tool. SEVERE:…
james goooseling
  • 771
  • 1
  • 6
  • 7
47
votes
3 answers
47
votes
6 answers

How to replace a value in web.xml with a Maven property?

I have a Maven project that downloads some test files into its build directory ./target/files. These files should then be available to a servlet, which I can easily achieve by hardcoding the full path as an of the servlet:
dokaspar
  • 8,186
  • 14
  • 70
  • 98
46
votes
3 answers

AngularJS HTML5 Mode - How do direct links work without server specific changes?

Note: This question could also read: How to support bookmarking of hashbang-less client side MVC frameworks in Java. I am transitioning an angular app that uses hashtags to one that is html5mode. I have successfully…
Robert Christian
  • 18,218
  • 20
  • 74
  • 89
44
votes
2 answers

java.lang.IllegalArgumentException: Invalid in servlet mapping

myservlet workflow.WDispatcher 2 myservlet
43
votes
12 answers

The content of element type "..." must match in web.xml

I have a problem with my web.xml file. The error: The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter- …
erencan
  • 3,725
  • 5
  • 32
  • 50
42
votes
3 answers

What's the purpose of async-supported in web.xml?

xxx xxx com.xxx.yyy true What's the purpose of async-supported in the…
jiafu
  • 6,338
  • 12
  • 49
  • 73
41
votes
2 answers

many url-pattern for the same servlet

I need to map the same servlet on two different url. I used netbeans 7.0.1 for managing my whole project, so I used its friendly interface to modify the web.xml file. What netbeans created is this:
eppesuig
  • 1,375
  • 2
  • 12
  • 28
41
votes
6 answers

How to configure welcome file list in web.xml

I have this in my web.xml document. I am trying to have a welcome list so I dont need to type the path for the home page anymore. But everytime a clicked the application in my tomcat page it displays The requested resource is not…
PeterJohn
  • 589
  • 3
  • 8
  • 15
40
votes
7 answers

Servlet and path parameters like /xyz/{value}/test, how to map in web.xml?

Does servlet support urls as follows: /xyz/{value}/test where value could be replaced by text or number. How to map that in the web.xml?
BlackEagle
  • 814
  • 2
  • 12
  • 13
40
votes
8 answers

Could not open ServletContext resource

This is quite similar question to one older but the solution did not work for me. I have a WAR package. In web.xml contextConfigLocation
kuncajs
  • 1,096
  • 1
  • 9
  • 20
39
votes
3 answers

Getting error: The content of element type "web-app" must match,

When I build my project in Eclipse Helios Service Release 2, I get an error in my web.xml. Please suggest what I have to do for this. In my project I am using DTD 2.2. The error is below. The content of element type "web-app" must match…
Amritesh Singh
  • 391
  • 1
  • 3
  • 5
39
votes
4 answers

DispatcherServlet and web.xml in Spring Boot

I'm currently trying to move my project from Java EE to Spring Boot project. However, i've been stucked and confused on the part with dispatcher servlet and web.xml and it seems like web.xml is no longer being read by the project anymore. The…
NatureWonder
  • 501
  • 1
  • 7
  • 10
39
votes
7 answers

Do I really need web.xml for a Servlet based Java web application?

I haven't been working on real world web projects. At university we used both Servlets and Spring for Java web development. In both projects we were given web.xml files already configured and we were doing only minor changes in them. Now I need to…
giliev
  • 2,938
  • 4
  • 27
  • 47