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"。

然后发现自己sqlMapConfig.xml中配置了StockPrice.xml,然而StockPrice.xml中,少了一句话

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

加上后程序正常运行。

我的sqlMapConfig.xml

我修改前错误的StockPrice.xml

修改后的StockPrice.xml

猜你喜欢

转载自my.oschina.net/u/2320807/blog/781941