我正在使用JBoss EAP-7.0.0
,并且试图迁移到WildFly 15
在WildFly 15
上,小平面的显示效果很好,但是当发生变化/偶数(例如选择日期为p:calendar或onchange p:selectOneMenu)时,我会收到错误消息。
10:21:31,690 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (default task-2) Error Rendering View[/secure/pages/site/namePageChangedByOwnerCompany.xhtml]: java.lang.IllegalArgumentException: Tipo de contenido no reconocido.
at com.sun.faces.renderkit.RenderKitImpl.createResponseWriter(RenderKitImpl.java:283)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.createResponseWriter(FaceletViewHandlingStrategy.java:1160)
...
10:21:31,904 SEVERE [org.omnifaces.exceptionhandler.FullAjaxExceptionHandler] (default task-2) FullAjaxExceptionHandler: An exception occurred during rendering JSF ajax response. Error page '/500.xhtml' will be shown.: java.lang.IllegalArgumentException: Tipo de contenido no reconocido.
这则消息。
糟糕! 处理ajax请求期间发生问题。随后,在处理错误页面的过程中发生了另一个问题,该问题应该通知您。 如果您是负责任的Web开发人员,那么是时候在错误页面本身中读取有关该错误的服务器日志了。
我正在查看这些Full ajax exception handler,post 2,Dealing Gracefully with ViewExpiredException in JSF2
Wildfly:15.0.1.2019年1月5日最终Java EE完整版和Web发行版
在我的pom.xml
中(我没有在pom中明确声明某些Mojarra版本)
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.2</version>
</dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>2.1</version>
</dependency>
在我的faces-config.xml
<factory>
<exception-handler-factory>
org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory
</exception-handler-factory>
</factory>
在我的web.xml
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.pf</url-pattern>
</servlet-mapping>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/secure/viewExpired.pf</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/secure/error500.pf</location>
</error-page>
在我的viewExpired.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>Nice View Expired Page</title>
</h:head>
<h:body>
<h:form>
<p>To protect your security, we have taken the liberty of logging you
out. Those who sacrifice liberty for security deserve to have
their views expired.</p>
<p>You were on page #{currentViewId}. Maybe that's useful.</p>
</h:form>
</h:body>
</html>
在我的error500.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Nice 500 Page</title>
</h:head>
<h:body>
<h:form>
<p>To protect your security, we have taken the liberty of logging you
out. Those who sacrifice liberty for security deserve to have
their views expired.</p>
<p>You were on page #{currentViewId}. Maybe that's useful.</p>
<ul>
<li>Date/time: #{of:formatDate(now, 'yyyy-MM-dd HH:mm:ss')}</li>
<li>User agent: #{header['user-agent']}</li>
<li>User IP: #{request.remoteAddr}</li>
<li>Request URI: #{requestScope['javax.servlet.error.request_uri']}</li>
<li>Ajax request: #{facesContext.partialViewContext.ajaxRequest ? 'Yes' : 'No'}</li>
<li>Status code: #{requestScope['javax.servlet.error.status_code']}</li>
<li>Exception type: #{requestScope['javax.servlet.error.exception_type']}</li>
<li>Exception message: #{requestScope['javax.servlet.error.message']}</li>
<li>Exception UUID: #{requestScope['org.omnifaces.exception_uuid']}</li>
<li>Stack trace:
<pre>#{of:printStackTrace(requestScope['javax.servlet.error.exception'])}</pre>
</li>
</ul>
</h:form>
</h:body>
</html>