Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 当使用Facelets 404错误页面时,Websphere抛出FileNotFoundException,而不是调度到404错误页面_Jsf_Jsf 2_Facelets_Custom Error Pages_Websphere Liberty - Fatal编程技术网

Jsf 当使用Facelets 404错误页面时,Websphere抛出FileNotFoundException,而不是调度到404错误页面

Jsf 当使用Facelets 404错误页面时,Websphere抛出FileNotFoundException,而不是调度到404错误页面,jsf,jsf-2,facelets,custom-error-pages,websphere-liberty,Jsf,Jsf 2,Facelets,Custom Error Pages,Websphere Liberty,我正在尝试将Facelets页面定义为my web.xml中的自定义404错误页面,如下所示: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com

我正在尝试将Facelets页面定义为my web.xml中的自定义404错误页面,如下所示:

<?xml version="1.0" encoding="UTF-8"?>

<web-app 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"
         version="3.0">
...
 <welcome-file-list>
        <welcome-file>/index.xhtml</welcome-file>
    </welcome-file-list>
<error-page>
      <error-code>404</error-code>
      <location>/pageNotFound.xhtml</location>
</error-page>
<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>*.xhtml</url-pattern>
</servlet-mapping>
...
</web-app>
在我以前的项目中,我们使用了WildFly 8.2.0.final服务器,这在我的项目中起到了作用。当我尝试使用JSP而不是Facelets页面时,它确实可以工作


在Websphere liberty profile 8.5.5.4中是否可以使用Facelets页面作为自定义错误页面?我需要在Websphere上进行更多配置吗?或者我在这里遗漏了什么?

所以你要求abc而没有分机?当您尝试使用扩展时会发生什么情况?当我转到abc.xhtml时,它会被发送到正确的页面。但是我在日志中也看到了一个错误:
应用程序类'org.apache.myfaces.shared_impl.context.flash.FlashImpl.isKeepMessages:392'java.lang.NullPointerException
。看起来您的容器和myfaces发行版有缺陷:错误页面阀无法捕获伪造的URL,因为它缺少扩展指向一个容器bug;MyFaces异常显然是flashscope实现中的一个bug
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">

    <!-- Enable features -->

<featureManager>
        <feature>jsp-2.2</feature> 
            <feature>ejbLite-3.1</feature> 
                <feature>jpa-2.0</feature> 
                <feature>jsf-2.0</feature> 
                <feature>cdi-1.0</feature> 
                <feature>localConnector-1.0</feature> 
                <feature>jaxws-2.2</feature> 
                <feature>jaxrs-1.1</feature> 
        </featureManager> 


    <httpEndpoint host="*" httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint"/> 

<applicationMonitor updateTrigger="mbean"/> 
    ...

</server>
Error Message: java.io.FileNotFoundException: SRVE0190E: File not found: /abc
Error Code: 404
Target Servlet: com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor
Error Stack: 
java.io.FileNotFoundException: SRVE0190E: File not found: /abc 
     at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:528) 
     at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1101) 
     at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4797) 
     at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:297) 
     at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981) 
     at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:262) 
     at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:938) 
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
     at java.lang.Thread.run(Thread.java:745)