SSM 生成mapper中xml文件:未能解析映射資源:「文件嵌套異常

錯誤日記我就網上隨便找個貼着:java

錯誤一:spring

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [C:\Users\Administrator\workspace\ssm-crud\target\classes\mapper\EmployeeMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving JdbcType. Cause: java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.com.go.crud.bean.Department

sql

 

網上找了好多方法試過,發現都仍是不行,有可能錯誤在如下幾個緣由:apache

1.看看本身mapper下有沒有空的xml文件session

2.仔細觀察mapper下的映射xml文件裏的SQL語句有沒有寫錯app

我再說說我本身的錯誤,我錯在寫返回類型和映射接口類的時候沒寫完整,因此到時程序出錯,看圖ui

錯誤二:spa

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'main' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [C:\Users\Administrator\workspace\ssm-crud\target\classes\mapper\EmployeeMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving JdbcType. Cause: java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.com.go.crud.bean.Departmentxml

第二個錯誤也是發現我加載spring-dao後綴名沒寫,若是spring文件前面還有文件夾必定要把它寫完整否則加載不了,下面來張圖blog

 

若是問題尚未解決能夠根據錯誤信息看看錯誤哪裏加載不了,好比說我這個Sqlsessionfactory說裝載不了bean那確定就是個人spring-dao獲取不到,仍是後面還提示說,找不到個人SqlMapper接口和找不到返回類型,因此致使程序錯誤。

 

最後說一句細心真的很重要、

相關文章
相關標籤/搜索