2

On Open Liberty 21.0.0.6., instead of presenting my welcome JSF page, my browser returns empty content when I point it to http://<host>:<port>/<ctxRoot>,

web.xml

<web-app id="WebApp_ID" 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"> <display-name>MyJSF</display-name> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.xhtml</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.xhtml</welcome-file> </welcome-file-list> </web-app> 

and a feature set of:

server.xml

<server> <featureManager> <feature>jaxrs-2.1</feature> <feature>cdi-2.0</feature> <feature>jpa-2.2</feature> <feature>jdbc-4.3</feature> <feature>jsf-2.3</feature> <feature>mpHealth-3.0</feature> </featureManager> 

ADDITIONAL INFO

I also have some other stuff in my app like JPA and JAX-RS.

1 Answer 1

3

ROOT CAUSE - JAX-RS application with "/" application path

In my case the problem is that I had a JAX-RS Application configured to use: @ApplicationPath("/") which was colliding with my goal of having the "/" application path serve up the welcome-file.

SOLUTION

Move the JAX-RS app to its own path within the WAR, e.g:

import javax.ws.rs.core.Application; @ApplicationPath("/api") public class TestApp extends Application { } 

THOUGHTS

This was easy to stumble into by taking an existing simple JAX-RS app using "/" as the app path, and then adding JSF to it. Then I thought I was having trouble with the JSF implementation.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.