Error creating bean with name 'sqlMapClient' defined in ServletContext resource的可能缘由

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in ServletContext resource [/WEB-INF/spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: ServletContext resource [/WEB-INF/ibatis/sqlMapConfig.xml]; nested exception is 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; lineNumber: 2; columnNumber: 9; 文档根元素 "sqlMap" 必须匹配 DOCTYPE 根 "null"。java

而后发现本身sqlMapConfig.xml中配置了StockPrice.xml,然而StockPrice.xml中,少了一句话spring

<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"      
"http://ibatis.apache.org/dtd/sql-map-2.dtd">

加上后程序正常运行。sql

个人sqlMapConfig.xmlapache

我修改前错误的StockPrice.xmlapp

修改后的StockPrice.xmlcode

相关文章
相关标签/搜索