Cannot set *.jsf as a welcome page in web.xml in JBoss EAP 6
Environment
JBoss Enterprise Application Platform (EAP) 6.x
Issue
JBossdoesn't handle welcome files for JSF. It should render my index.jsf, but it just doesn't. I get a blank page.- Steps to reproduce:
- deploy
- go to
/welcome-bug/ - jboss show you a
404 page: JBWEB000065: HTTP Status 404-/welcome-bug/ - go to
/welcome-bug/index.jsf - it displays the page, so servlet mappings are ok.
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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">
<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>*.jsf</url-pattern>
</servlet-mapping>
...
<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
</welcome-file-list>
</web-app>
Resolution
JBoss Web in JBoss EAP 6.x expects the welcome-root specified to be a file, so create an empty index.jsf in the root of the war as a workaround.
Apply JBoss EAP 6.4 Cumulative Patch (CP) 7 and set this system property
-Dorg.apache.tomcat.util.http.mapper.STRICT_WELCOME_FILES=true
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.