在Open Liberty 21.0.0.6.上,当我将其指向http://<host>:<port>/<ctxRoot>时,浏览器返回空内容,而不是显示我的欢迎JSF页面。
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>以及以下功能集:
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>更多信息
我的应用程序中还有一些其他的东西,比如JPA和JAX-RS。
发布于 2021-06-24 01:58:41
根本原因-具有"/“应用程序路径的JAX-RS应用程序
在我的例子中,问题是我将一个JAX-RS应用程序配置为使用:@ApplicationPath("/"),这与我希望让"/“应用程序路径提供欢迎文件的目标相冲突。
解决方案
在WAR中将JAX-RS应用程序移动到它自己的路径,例如:
import javax.ws.rs.core.Application;
@ApplicationPath("/api")
public class TestApp extends Application { }思考
通过使用"/“作为应用程序路径的现有简单JAX-RS应用程序,然后将JSF添加到其中,很容易就会遇到这种情况。然后,我认为我在JSF实现方面遇到了问题。
https://stackoverflow.com/questions/68104993
复制相似问题