Tôi đang sử dụng Omnifaces 1.3 + Primefaces 3.4.1 + Jboss 7.1.1 Final nhưng tôi không thể chuyển hướng các ngoại lệ với FullAjaxExceptionHandler
được định cấu hình trên số web.xml
khi chúng đến theo yêu cầu ajax. Không có gì xảy ra, chỉ một ngoại lệ khác:java.lang.AbstractMethodError: org.apache.xerces.dom.ElementImpl.getTextContent() Ljava/lang/String
19:38:05,467 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/taxMileage].[Faces Servlet]] (http--0.0.0.0-8181-4) Servlet.service() for servlet Faces Servlet threw exception: java.lang.AbstractMethodError: org.apache.xerces.dom.ElementImpl.getTextContent()Ljava/lang/String;
at org.omnifaces.config.WebXml.parseErrorPageLocations(WebXml.java:216) [omnifaces-1.3.jar:1.3]
at org.omnifaces.config.WebXml.<init>(WebXml.java:84) [omnifaces-1.3.jar:1.3]
at org.omnifaces.config.WebXml.<clinit>(WebXml.java:53) [omnifaces-1.3.jar:1.3]
at org.omnifaces.exceptionhandler.FullAjaxExceptionHandler.handleAjaxException(FullAjaxExceptionHandler.java:162) [omnifaces-1.3.jar:1.3]
at org.omnifaces.exceptionhandler.FullAjaxExceptionHandler.handle(FullAjaxExceptionHandler.java:145) [omnifaces-1.3.jar:1.3]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:]
Ai đó có thể cho tôi lời khuyên về điều này không? Tôi bị kẹt. Nếu tôi gọi cùng một lỗi mà không có ajax thì ngoại lệ sẽ được chuyển hướng chính xác.
web.xml
của tôi:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0"
>
<display-name>taxMileage</display-name>
<welcome-file-list>
<welcome-file>/pages/protected/user/dashboard.xhtml</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>InitializeApplication</servlet-name>
<servlet-class>com.taxMileage.server.util.InitializeApplication</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>south-street</param-value>
</context-param>
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<filter>
<filter-name>facesExceptionFilter</filter-name>
<filter-class>org.omnifaces.filter.FacesExceptionFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>facesExceptionFilter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
<url-pattern>*.jsf</url-pattern>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<!-- -->
<!-- Protected area definition -->
<security-constraint>
<web-resource-collection>
<web-resource-name>Restricted Area - ADMIN Only</web-resource-name>
<url-pattern>/pages/protected/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>ADMIN</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Restricted Area - USER and ADMIN</web-resource-name>
<url-pattern>/pages/protected/user/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>USER</role-name>
<role-name>ADMIN</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Secured resources</web-resource-name>
<url-pattern>/rest/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<!-- Login page -->
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/pages/public/login.xhtml</form-login-page>
<form-error-page>/pages/public/loginError.xhtml</form-error-page>
</form-login-config>
</login-config>
<!-- System roles -->
<security-role>
<role-name>ADMIN</role-name>
</security-role>
<security-role>
<role-name>USER</role-name>
</security-role>
<error-page>
<exception-type>java.lang.RuntimeException</exception-type>
<location>/pages/error/error1.xhtml</location>
</error-page>
</web-app>
faces-config.xml
của tôi:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config 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-facesconfig_2_1.xsd"
version="2.1">
<lifecycle>
<phase-listener>com.taxMileage.server.util.MultiPageMessagesSupport</phase-listener>
</lifecycle>
<factory>
<exception-handler-factory>org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory</exception-handler-factory>
</factory>
<application>
<resource-bundle>
<base-name>messages</base-name>
<var>msgs</var>
</resource-bundle>
</application>
</faces-config>
Cảm ơn!
Bạn hoàn toàn đúng ... Cảm ơn bạn rất nhiều! Món quà giáng sinh của tôi! – Basileus
Bạn được chào đón. – BalusC
Câu trả lời đúng. Cảm ơn –