在eclipse上配置ssm框架的时候出现一下问题,一直困扰很久。

Error creating bean with name ‘org.mybatis.spring.SqlSessionFactoryBean#0’ defined in file [E:\tools\apache-tomcat-8.5.33\webapps\boot-crm\WEB-INF\classes\spring\applicationContext-dao.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [mybatis/SqlMapConfig.xml] cannot be opened because it does not exist

class path resource [mybatis/SqlMapConfig.xml] cannot be opened because it does not exist

说我的SqlMapConfig.xml打不开,因为文件不存在

class path resource [mybatis/SqlMapConfig.xml] cannot be opened because it does not exist
这是我项目的目录

其实这个问题往往是像我这种新手常常会犯错的小问题,在ssm框架配置时,设置MyBatis核心配置文件把路径写错了

class path resource [mybatis/SqlMapConfig.xml] cannot be opened because it does not exist
class path resource [mybatis/SqlMapConfig.xml] cannot be opened because it does not exist
SqlMapConfig.xml文件并不在一个mybatis的包里面,而是直接在第一层目录上面
所以直接把“mybatis/”删除就好,删除了之后程序跑通了。

其实也是自己没有好好看错误,看到英语就不想看那种,其实自己一字一句看下来还是可以明白意思,然后再根据问题去想配置问题上互相关联的关系,就可以很快找出问题。

相关文章: