Web容器在启动时加载 spring 配置文件时解析xml失败常常引起容器启动失败。这次配置文件是 ibatis的sql脚本出了问题:
Context initialization failed
org.springframework. beans.factory. BeanCreationException:Error creating bean with name 'wlfDao' defined in file [applicationContext-wlf.xml]: Cannot resolve reference to bean 'sqlMapClient' while settling bean property 'sqlMapClient'; nested exception is org.springframework. beans.factory. BeanCreationException: Error creating bean with name 'sqlMapClient' defined in class path resource [applicationContext-datasource.xml]: Invocation of method failed; nested exception is java.lang.RuntimeException: Error occurred. Cause: com.ibatis. comm. xml.NodeletException:Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: com.ibatis. comm. xml.NodeletException: Error parsing XML. Cause: jave.lang.RuntimeException: Error parsing XPath '/sqlMap/insert'. Cause: jave.util.NoSuchElementException
...
报错信息太多,就不一一贴出来了,而且错误信息没有把错误的根源显示出来,最终定位是另一个文件wlfSync.xml里的insert脚本中参数name少写了一个#:
<insert id='insert' parameterClass='wlfBean'> insert into t_wlf_task values (#objectid#,#name,#ruleid#) <insert>