web.xml validation error

10,796

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>
Share:
10,796
michael nesterenko
Author by

michael nesterenko

Exploring this world....

Updated on June 04, 2022

Comments

  • michael nesterenko
    michael nesterenko almost 2 years

    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"
    
  • Tires
    Tires over 11 years
    Isn't XML-Standard for xmlns-Attributes to use URIs rather than URLs? Concrete: xmlns:web="java.sun.com/xml/ns/javaee". If no reason comes up here, I will edit the answer in 4 weeks or so.