SSM 生成mapper中xml文件:未能解析映射资源:“文件嵌套异常

错误日记我就网上随便找个贴着:

错误一:

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接口和找不到返回类型,所以导致程序错误。

 

最后说一句细心真的很重要、

 

posted @ 2018-12-08 01:08  小江。  阅读(1896)  评论(0编辑  收藏  举报