I'm using the OmniFaces ExtensionlessURL FacesViews feature in one of my projects and have found that this feature does not appear to work when the web application is packaged as skinny WAR archive inside an EAR archive and deployed to either a Wildfly container or a WebSphere Liberty Profile container. On both containers I get a 404 error if I try to access a page without the .xhtml suffix.
If I deploy the same EAR archive which contains a skinny WAR archive to a GlassFish container or a WebLogic container, then the ExtensionlessURL feature works as expected and the pages are accessible without the .xhtml suffix.
If I deploy an EAR archive which contains a normal WAR archive (i.e. the OmniFaces jar is stored in the WAR archive's WEB-INF/lib folder), then the ExtensionlessURL works as expected on a WildFly container and a WebSphere Liberty Profile container in addition to the GlassFish and WebLogic containers.
The version of WildFly I'm using is 9.0.2 and the version of WebSphere Liberty Profile is 8.5.5.7. The version of OmniFaces I'm using is 2.2
Is there something I can change within my configuration to allow the OmniFaces Extensionless URL feature to be used with skinny WAR archives on Wildfly and WebSphere Liberty profile containers or is this a bug?
To troubleshoot this issue I've created a self contained example which contains the bare minimum needed to reproduce the problem.
The web.xml file is as follows:
<web-app 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_3_1.xsd"
version="3.1">
<context-param>
<param-name>org.omnifaces.FACES_VIEWS_SCAN_PATHS</param-name>
<param-value>/*.xhtml</param-value>
</context-param>
<servlet>
<servlet-name>facesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>facesServlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
The configuration for the Maven WAR plugin is as follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
The configuration for the Maven EAR plugin is as follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<version>7</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<skinnyWars>true</skinnyWars>
<modules>
<webModule>
<groupId>${project.groupId}</groupId>
<artifactId>extensionless-web</artifactId>
<context-root>/extensionless-web</context-root>
</webModule>
</modules>
</configuration>
</plugin>
The Maven EAR project also contains the following dependency to pull in the dependencies from the WAR project:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>extensionless-web</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>