The Wayback Machine - https://web.archive.org/web/20240906185738/https://www.geeksforgeeks.org/how-to-resolve-web-xml-is-missing-and-failonmissingwebxml-is-set-to-true-in-eclipse-sts/
Open In App

How to Resolve WEB xml is missing and failOnMissingWebXml is set to true in Eclipse/STS?

Last Updated : 28 Apr, 2022
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Eclipse/STS IDE is generally used to develop Spring applications and what happens is whenever we are creating a simple Maven project and if the web.xml is missing or you have deleted that file then you may encounter this problem inside the pom.xml file corresponding to which do refer to the below image as follows: 

 

Now we are going to discuss how can we resolve this error via discussing two ways to fix this error which are as follows:

  1. Modifying the pom.xml file.
  2. Generating Deployment Descriptor Stub.

Solution 1: Modification in the pom.xml file

The simple and best solution for this problem is, just write the following line of code inside the <properties> tag something like this.

<properties>
    <failOnMissingWebXml>false</failOnMissingWebXml>
</properties>

And this will resolve the error. Refer to the below image. 

 

Note: We can see the error has been gone. 

Solution 2: Generate Deployment Descriptor Stub

The other solution is, click on your project > right-click > Java EE Tools > Generate Deployment Descriptor Stub as shown in the below image. 

 

And this will generate the web.xml file inside the WEB-INF folder with some pre-defined code as shown in the below image. And it will also resolve the error. 

 

Tip: Now heeks you must be wondering which way is better so straight forward answer is that Solution 1 is a better solution than adding an empty web.xml because this way the final product stays clean, we are just changing the build parameters.


Previous Article
Next Article

Similar Reads

Servlet - welcome-file-list in web.xml
The web.xml file's welcome-file-list property is used to establish a list of welcome files. If you don't supply a file name while loading the project in the browser, the tag &lt;welcome-file-list&gt; is used to define the files that will be called by the server by default. The server looks for the welcome file in the following sequence by default:
2 min read
Spring MVC Application Without web.xml File
Spring MVC framework enables separation of modules namely Model, View, and Controller, and seamlessly handles the application integration. This enables the developer to create complex applications also using plain java classes. Here we will be creating and running Your First Spring MVC Application, whenever we are Configuring Dispatcher Servlet we
4 min read
How to Configure Dispatcher Servlet in web.xml File?
DispatcherServlet acts as the Front Controller for Spring-based web applications. So now what is Front Controller? So it is pretty simple. Any request is going to come into our website the front controller is going to stand in front and is going to accept all the requests and once the front controller accepts that request then this is the job of th
5 min read
What is Heap Pollution in Java and how to resolve it?
What is Heap Pollution? Heap pollution implies that we have bad data in our heap memory. In Java language, heap pollution is a situation that occurs when a variable of parameterized type points to an object that is not of that parameterized type. How is Heap Pollution detected? Usually, the compiler detects the heap pollution situation at the compi
3 min read
Path resolve() method in Java with Examples
resolve() method of java.nio.file.Path used to resolve the given path against this path. There are two types of resolve() methods. resolve(String other) method of java.nio.file.Path used to converts a given path string to a Path and resolves it against this Path in the exact same manner as specified by the resolve method. For example, If the name s
3 min read
How to Resolve Java.lang.ExceptionInInitializerError In Java?
An unexpected, unwanted event that disturbed the normal flow of a program is called an Exception. There are mainly two types of exception in Java: 1. Checked Exception 2. Unchecked Exception ExceptionInInitializerError is the child class of the Error class and hence it is an unchecked exception. This exception is rise automatically by JVM when JVM
3 min read
How to Resolve The Cannot Find Symbol Error in Java?
The Cannot Find Symbol Error in Java error occurs when the Java compiler cannot find a symbol that you are trying to reference in your code. In this article, we will explore how to resolve the "Cannot Find Symbol" error in Java. The "Cannot Find Symbol" error occurs when you are trying to reference a symbol that has not been defined or imported pro
5 min read
Java Architecture for XML Binding ( JAXB ) | Set-1
Java Architecture for XML Binding (JAXB) defines an API for reading and writing Java objects to and from XML documents. JAXB gives Java developers an efficient and standard way of mapping between XML and Java code. JAXB makes it easier for developers to extend their applications with XML and Web Services technologies.At First JAXB was developed as
4 min read
Hibernate Mapping Set using XML
In Hibernate, if we want to map one table to another with the help of a set then we use Set mapping. Set mapping can be performed if the model class or persistent class contains a set as its element. To perform set mapping, we can use a set in the mapping file. let's see how we can configure the XML mapping file for the mapping set in hibernate. Pr
5 min read
How to Create and Modify Properties File Form Java Program in Text and XML Format?
Properties file are a text-oriented key value a pair of contents present in a Java project with .properties extension. Line by line, the key-value pair of contents are present, and they are usually prepared by means of notepad, Wordpad, EditPlus, etc., Properties files are usually helpful to store important sensitive information and in this article
5 min read
How to draw Horizontal and Vertical lines in an Android App using XML
This article demonstrates how to draw a horizontal and a vertical line in an Android app. Although we have countless XML tags to meet almost all of our needs, unfortunately, we don't have any tag such as &lt;line&gt; tag to draw the line. However, &lt;view&gt; tag can be used in XML as a workaround. NOTE: The "view" tag is different than the View c
2 min read
Find the smallest positive number missing from an unsorted array | Set 3
Given an unsorted array with both positive and negative elements. The task is to find the smallest positive number missing from the array. Examples: Input: arr[] = {2, 3, 7, 6, 8, -1, -10, 15} Output: 1 Input: arr[] = { 2, 3, -7, 6, 8, 1, -10, 15 } Output: 4 Input: arr[] = {1, 1, 0, -1, -2} Output: 2 Approach : We have already discussed some of the
6 min read
javax.xml.crypto Package in Java
Common classes having the XML cryptography for the Package javax.xml.crypto. now this crypto package includes similar classes that are used to accessing XML cryptographic on its operations, such as creating an XML signature or encrypted XML data. There are two types of javax.xml.crypto classes in this package that are KeySelector class, which allow
4 min read
Spring - AOP AspectJ Xml Configuration
Spring allows you to specify aspects, recommendations, and pointcuts in an XML file. Annotations were used in the aop examples on the preceding page. The XML configuration file will now show us the same samples. Let's look at the XML components that describe advice. aop:before: It's used before the real business logic procedure is called.aop:after:
7 min read
Hibernate Example using XML in Eclipse
Hibernate is a framework that provides some abstraction layer, meaning that the programmer does not have to worry about the implementations, Hibernate does the implementations for you internally like Establishing a connection with the database, writing queries to perform CRUD operations, etc. In this article, let us see a Hibernate Example using XM
6 min read
XML EventWriter in Java StAX API
Java StAX API was introduced in Java 6 and considered superior to DOM and SAX parsers. We can use Java StAX parser to read XML file and java Streaming API for XML (Java StAX) provides implementation for processing XML in java. The XMLEventWriter class in the Java StAX API allows you to write StAX XMLEvent's either to a Writer, an OutputStream, or a
3 min read
XML Output Factory in Java StAX
StAX provides various classes to create XML stream readers, writers, and events by using the XMLInputFactory, XMLOutputFactory, and XMLEventFactory classes. In this article we're going to study about XML Output Factory . The class javax.xml.stream.XMLOutputFactory is a root component of the Java StAX API. From this class you can create both an XMLS
3 min read
Spring - REST XML Response
The popularity of REST API is increasing day by day as it fulfills architecting an application in a convenient manner. A REST API is an acronym for 'Representational state transfer'. It is also called RESTful web services. It is also a 'Controller', but with a difference that Rest Controller returns Data, while Controller returns a View of 'Model-V
7 min read
Hibernate - Table Per Concrete Class using XML File
Hibernate is capable of storing the inherited properties of an object along with its new properties in its database when an object is saved in the database. In Hibernate, inheritance between POJO classes is applied when multiple POJO classes of a module contain some common properties. In a real-time application, POJO classes of Hibernate are design
5 min read
Hibernate - Table Per Hierarchy using XML File
Hibernate is capable of storing the inherited properties of an object along with its new properties in its database when an object is saved in the database. In Hibernate, inheritance between POJO classes is applied when multiple POJO classes of a module contain some common properties. In a real-time application, POJO classes of Hibernate are design
6 min read
Hibernate - Table Per Subclass Example using XML File
In Table Per Subclass, subclass tables are mapped to the Parent class table by primary key and foreign key relationship. In a Table per Subclass strategy : For each class of hierarchy there exist a separate table in the database.While creating the database tables foreign key relationship is required between the parent table and the child table.To p
5 min read
Spring Security XML
Spring Security is a powerful way to provide authentication as well as authorization to Spring application. Spring Security is a powerful tool that provides the feature of custom security configuration to the user, security configuration in spring can be customized in two ways as listed below as follows: XML-based configurationJava configuration. I
4 min read
What is SAX in XML?
The XML-DEV mailing group developed a Simple API for XML also called the SAX, which is an event-driven online algorithm for parsing XML documents. SAX is a way of reading data from an XML document that is an alternative to the Document Object Model's mechanism (DOM). Whereas the DOM works on the document as a whole, creating the whole abstract synt
3 min read
Spring Application Without Any .xml Configuration
Spring MVC Application Without the web.xml File, we have eliminated the web.xml file, but we have left with the spring config XML file that is this file "application-config.xml". So here, we are going to see how to eliminate the spring config XML file and build a spring application without any .xml configuration. Implementation: Project Let us demo
4 min read
Hibernate - Logging by Log4j using xml File
The process of Hibernate Logging by Log4j using an XML file deals with the ability of the computer programmer to write the log details of the file he has created by executing it permanently. The most important tools in Java language like the Log4j and Log back frameworks. These frameworks in Java language help the programmer to install and initiate
5 min read
XML EventWriter in Java StAX
Java StAX API is also called Java Streaming API for XML and it was introduced in Java 6. This is the most wanted API while considering DOM and SAX parsers. StAX consists of cursor-based API and iterator-based API. In this article, let us see how to prepare an XML file in java using StAX Iterator-based API (XMLEventWriter). For creating an XML struc
5 min read
Produce XML Response with Spring WebMVC Controller
In this article, we will explore the mechanisms and aspects of Spring WebMVC – producing XML responses with controllers. And also guides Java developers through the steps of configuring a Spring WebMVC controller to produce XML responses. There are three main approaches to configuring Spring MVC controllers to produce XML responses: JAXB Marshallin
3 min read
StAX XML Parser in Java
This article focuses on how one can parse a XML file in Java.XML : XML stands for eXtensible Markup Language. It was designed to store and transport data. It was designed to be both human- and machine-readable. That’s why, the design goals of XML emphasize simplicity, generality, and usability across the Internet. Why StAX instead of SAX ? SAX: The
6 min read
XML - Based Injection in Spring
In this article, we will be exploring XML-based Injection in Spring. and also creating a sample course management system using ApplicationContext that manages the complete lifecycle of a bean from its creation to destruction in a seamless manner. XML-based injectionXML-based injection refers to security vulnerabilities that can occur in Spring appl
4 min read
JUnit 5 - XML Report Example
In Spring Boot, JUnit can be used for unit testing frameworks in Java, and Junit5 is the latest version. Junit provides a set of tools and APIs for developers to use to write and execute automated tests, and it is primarily used for unit testing Java applications. It is an open-source testing framework. Key Terminologies: Test case: Test cases can
6 min read
Article Tags :
Practice Tags :