AreaDaoTest 用junit去跑可以成功,网页输出area表中信息是报错
来源:4-5 店铺注册之Service层的实现
慕瓜4481943
2018-10-21
AreaDaoTest 用junit去跑可以成功,网页输出area表中信息是报错:Error creating bean with name ‘sqlSessionFactory’ defined in file [E:\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\o2o\WEB-INF\classes\spring\spring-dao.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [E:\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\o2o\WEB-INF\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
请问老师,这个类是存在的,为什么会报找不到呢?
1回答
-
同学好,同学可以去到 E:\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\o2o\WEB-INF\classes下面看看有没有这个com.imooc.o2o.entity.Area 类,eclipse或者ide执行Web程序的时候,是会自动把项目打包发布到这类目录下去执行的。同学可以试着右键tomcat clean一下项目试试。如果还不行,你用的是eclipse还是idea呢?需要设置eclipse server tomcat里面的项目发布路径。具体可以试试https://www.cnblogs.com/zhangcybb/p/4516327.html
042018-10-22
相似问题