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

相關文章
相關標籤/搜索