1. 程式人生 > >Struts2中配置全域性異常處理時報錯 org.xml.sax.SAXParseException

Struts2中配置全域性異常處理時報錯 org.xml.sax.SAXParseException

在配置Struts2的struts.xml中的<global-exception-mapping>來配置全域性異常處理時,報這個錯誤:

org.xml.sax.SAXParseException: Element type "global-exception-mapping" must be declared.

at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)

找了快一個小時才發現應該是<global-exception-mappings>...只是少了個字母,浪費了一個鐘頭。