錯誤日記我就網上隨便找個貼着:
錯誤一:
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
網上找了好多方法試過,發現都還是不行,有可能錯誤在以下幾個原因:
1.看看自己mapper下有沒有空的xml文件
2.仔細觀察mapper下的映射xml文件里的SQL語句有沒有寫錯
我再說說我自己的錯誤,我錯在寫返回類型和映射接口類的時候沒寫完整,所以到時程序出錯,看圖
錯誤二:
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.Department
第二個錯誤也是發現我加載spring-dao后綴名沒寫,如果spring文件前面還有文件夾一定要把它寫完整不然加載不了,下面來張圖
如果問題還沒有解決可以根據錯誤信息看看錯誤哪里加載不了,比如說我這個Sqlsessionfactory說裝載不了bean那肯定就是我的spring-dao獲取不到,還是后面還提示說,找不到我的SqlMapper接口和找不到返回類型,所以導致程序錯誤。
最后說一句細心真的很重要、