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>
