Standard deployment descriptor web.xml for Java EE 8 returns error

2.4k Views Asked by At

I am trying to write a small web application with the new Java EE 8 in a NetBeans 8.2 IDE. I set up a web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="4.0" 
    xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"> 
  <context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
  </context-param>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>
  <session-config>
    <session-timeout>
      30
    </session-timeout>
  </session-config>
  <welcome-file-list>
    <welcome-file>faces/index.xhtml</welcome-file>
    <welcome-file>index.xhtml</welcome-file>
  </welcome-file-list>
</web-app>

If I am trying to validate the XML file I get the following error

XML validation started. Checking file:/Users/xxx/Development/projects/TestTrial/src/main/webapp/WEB-INF/web.xml... Referenced entity at "http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd". Vorzeitiges Dateiende. [1] http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd XML validation finished.

Which tells me, that there is a preliminary end of file. If I change it from 4.0 to 3.1 everthing works fine. The following software was used NetBeans 8.2 / JDK 1.8u152 / glassfish v5

I am pretty new to Java EE and help would be appreciated.

0

There are 0 best solutions below