请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

老师您好,第二章junit测试dao层的时候报错 Error creating bean with name 'sqlSessionFactory'

图片描述
图片描述
按提示说是spring-dao层的sqlSessionFactory出错
图片描述
这是sqlSessionFactory的代码,实体类的包确实放在com.qml.o3o.entity中,图片描述
AreaDao.xml里的命名空间也确认过了,还是没有解决,想请教一下老师这是哪里出了问题啊

正在回答

1回答

翔仔 2019-03-28 23:33:22

同学好,错误没截全呀,error bean后面的信息不全,同时ut里面的failure trace也给出来一下。

0 回复 有任何疑惑可以回复我~
  • 提问者 一夜启明 #1
    error bean后面的截图在第一张图下面。
    failure trace在哪里查看呢?
    回复 有任何疑惑可以回复我~ 2019-03-28 23:39:32
  • 翔仔 回复 提问者 一夜启明 #2
    init failed后面的nested是什么Error 同学要不直接把异常复制粘贴出来吧。failure trace就是你ut执行的时候,会有一栏显示ut的执行结果的
    回复 有任何疑惑可以回复我~ 2019-03-29 01:07:24
  • 提问者 一夜启明 回复 翔仔 #3
    警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring/spring-dao.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Program File\javaIDE\java_workspace\o3o\target\classes\mapper\AreaDao.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.imooc.o2o.entity.Area'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.imooc.o2o.entity.Area
    三月 29, 2019 1:31:11 下午 org.springframework.test.context.TestContextManager prepareTestInstance
    严重: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@6b143ee9] to prepare test instance [com.qml.o3o.dao.AreaDaoTest@2df9b86]
    java.lang.IllegalStateException: Failed to load ApplicationContext
    回复 有任何疑惑可以回复我~ 2019-03-29 13:33:23
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信