我是靠谱客的博主 傲娇棒球,这篇文章主要介绍mybatis初始化SqlSessionFactory失败的几个原因分析,现在分享给大家,希望可以做个参考。

mybatis初始化SqlSessionFactory失败

总结原因有几点

1.resources中的xml配置文件放错位置或者是放的太深加载不到

比如 RoleDao因为放的比较包中包中所以扫描不到

2.xml文件里面有错文

比如mapper namespace的相对路径有问题 导致初始化错误


SqlSessionFactory异常

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory' defined in class path resource [spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘class path resource [mybatis]'; nested exception is java.io.FileNotFoundException: class path resource [mybatis] cannot be opened because it does not exist

sqlSessionFactory配置文件路径错误


以上为个人经验,希望能给大家一个参考,也希望大家多多支持靠谱客。

最后

以上就是傲娇棒球最近收集整理的关于mybatis初始化SqlSessionFactory失败的几个原因分析的全部内容,更多相关mybatis初始化SqlSessionFactory失败内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(170)

评论列表共有 0 条评论

立即
投稿
返回
顶部