Ibatis XML 配置文件注释引起错误及解决方案
最近在使用Ibatis組件進行一個項目開發,在運行時發現提示如下錯誤信息:
type 異常報告
消息
描述服務器遇到一個內部錯誤 (), 無法完成此請求。
異常
javax.servlet.ServletException: java.lang.ExceptionInInitializerError根本原因
java.lang.ExceptionInInitializerError根本原因
java.lang.RuntimeException: Error occurred.? Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.? Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.? Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.? Cause: org.xml.sax.SAXParseException: The string "--" is not permitted within comments.根本原因
com.ibatis.common.xml.NodeletException: Error parsing XML.? Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.? Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.? Cause: org.xml.sax.SAXParseException: The string "--" is not permitted within comments.根本原因
java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.? Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.? Cause: org.xml.sax.SAXParseException: The string "--" is not permitted within comments.根本原因
com.ibatis.common.xml.NodeletException: Error parsing XML.? Cause: org.xml.sax.SAXParseException: The string "--" is not permitted within comments.根本原因
org.xml.sax.SAXParseException: The string "--" is not permitted within comments.
-----------------------------------------------------
從錯誤描述來看發現是XML文件中的注釋引起的異常,去掉配置文件中的中文注釋或改用英文描述則可以通過
后來發現是配置文件中采用:單數個中文或字母后跟單數個中文再用“-->”結束注釋(中文后不加空格)
如:<!-- 單數個中文-->、<!-- a單數個中文-->
時就會報此異常
爭對此異常可以采用在左右邊界加上空格的方式解決。 如像這樣是對的 <!--?? 中文注解??? -->
轉載于:https://www.cnblogs.com/lxJack/archive/2011/05/25/2057536.html
總結
以上是生活随笔為你收集整理的Ibatis XML 配置文件注释引起错误及解决方案的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Oracle的函数大全
- 下一篇: asp.net ajax控件工具集 Au