加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 23:40:37 所属栏目:百科 来源:网络整理
导读:错误日记我就网上随便找个贴着: 错误一: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘ sqlSessionFactory ‘ defined in class path resource [applicationContext.xml]: Invocation of init method failed;

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

错误一:

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

?

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读