java /faces/index.xhtml 未在 ExternalContext 中作为 Glassfish 中的资源找到
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17948066/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
/faces/index.xhtml Not Found in ExternalContext as a Resource in Glassfish
提问by user2634009
I am getting this error while launching application.
启动应用程序时出现此错误。
com.sun.faces.context.FacesFileNotFoundException: /faces/index.xhtml Not Found in ExternalContext as a Resource
com.sun.faces.context.FacesFileNotFoundException: /faces/index.xhtml 未在 ExternalContext 中作为资源找到
This is the context of web.xml:
这是 web.xml 的上下文:
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>#{themeSwitcherBean.theme}</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>/faces/*</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-list>
</web-app>
采纳答案by Flo
The index.xhtml cant be found, which you declared in your web.xml as Welcome/Index file
找不到您在 web.xml 中声明为欢迎/索引文件的 index.xhtml
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>