项目源码导入eclipse以后用Tomcat启动后提示找不到Mybatis拦截器相关类

来源:2-3 _后台项目环境搭建

Unlimitedbladewo0

2017-06-20

下午 org.springframework.web.context.support.XmlWebApplicationContext refresh

警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in file [E:\JAVA_PROJECT\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\comment\WEB-INF\classes\spring\applicationContext-dao.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [spring/mybatis.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'org.imooc.dao.interceptor.PageInterceptor'.  Cause: java.lang.ClassNotFoundException: Cannot find class: org.imooc.dao.interceptor.PageInterceptor


在mybatis.xml里面将PageInterceptor注释掉以后再启动,又爆出以下错误

六月 20, 2017 6:05:50 下午 org.springframework.web.context.support.XmlWebApplicationContext refresh

警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in file [E:\JAVA_PROJECT\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\comment\WEB-INF\classes\spring\applicationContext-dao.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\JAVA_PROJECT\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\comment\WEB-INF\classes\mapper\ActionDao.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 'Action'.  Cause: java.lang.ClassNotFoundException: Cannot find class: Action


提示找不到类别名,但是查看applicationContext-dao.xml里面有配置typeAliasesPackage,依然报错不知何解。



写回答

2回答

源生活

2017-06-20

如果你确定你的这些Java类都是存在并且成功编译的,那么这种情况会在每次重新打开eclipse时会发生,你可以随便改一下java代码,加个空格都行,然后republish工程,就好了。

0
1
Unlimitedbladewo0
非常感谢!
2017-06-20
共1条回复

Unlimitedbladewo0

提问者

2017-06-20

已解决,最后发现是eclipse的设置问题,把工作空间彻底清理了一遍重新导入居然就ok了。。。

之前一直都是用.NET做项目,转到JAVA这边发现IDE满蛋疼的。。。

0
0

IT段子手详解MyBatis遇到Spring 秒学Java SSM开发大众点评

【毕设】SSM全面梳理,前后端分离,zTree 和复杂SQL打造权限系统,解惑MyBatis和RESTful

1001 学习 · 485 问题

查看课程