最近在使用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单数个中文--> 时就会报此异常 争对此异常可以采用在左右边界加上空格的方式解决。
在Eclipse中开发时不太容易出现此异常,因为Eclipse的XML 格式化功能会自动在书写时加上空格,但如果用netbeans 开发时则要注意此项自己手动加上空格。
其实不仅仅是ibatis配置文件,其它在书写hibernate等其它配置文件时最好也加上空格,以免发生此异常