Search code examples
servletsjakarta-eeweb.xml

web.xml validation error


I have got one more error in web xml

-Cannot resolve the name 'javaee:web-appType' to a(n) 'type definition' component.

and web.xml file

<?xml version="1.0" encoding="UTF-8"?><!--error here-->
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"

Solution

  • You forgot the xmlns:web namespace. Here's the complete Servlet 3.0 compatible declaration.

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app
        xmlns="http://java.sun.com/xml/ns/javaee" 
        xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
        id="Your_Webapp_ID" version="3.0">
    
        <!-- Config here -->
    
    </web-app>