请稍等 ...
×

采纳答案成功!

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

Mybatis的拦截器,有时可以使用,有时又莫名其妙不可以使用,时不时就会报找不到拦截器类

Caused by: org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.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 'com.interceptor.PageInterceptor'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.interceptor.PageInterceptor

at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:500)

at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:380)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)

... 49 more

Caused by: 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 'com.interceptor.PageInterceptor'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.interceptor.PageInterceptor

at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:115)

at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:95)

at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:494)

... 52 more

Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.interceptor.PageInterceptor'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.interceptor.PageInterceptor

at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:118)

at org.apache.ibatis.builder.xml.XMLConfigBuilder.pluginElement(XMLConfigBuilder.java:148)

at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:104)

... 54 more

Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.interceptor.PageInterceptor'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.interceptor.PageInterceptor

at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:120)

at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:149)

at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:116)

... 56 more

Caused by: java.lang.ClassNotFoundException: Cannot find class: com.interceptor.PageInterceptor

at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:200)

at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:89)

at org.apache.ibatis.io.Resources.classForName(Resources.java:261)

at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:116)

... 58 more

不晓得为什么会报这错误,

正在回答 回答被采纳积分+3

1回答

源生活 2017-09-07 09:06:12

开发工具每次重新打开确实可能会出现这种情况,需要在Tomcat下重新【Publish】一下工程,如果还是不行,你可以随意修改工程里一个文件,比如加个空格或回车,让Tomcat出现【Republish】的提示,然后【Publish】,一定有效,就是让Tomcat知道工程有变化,需要重新部署,这个时候就好了,可能是开发工具每次重新打开后,Tomcat上次部署的工程会缺class,具体原因不明,可能是eclipse的一个bug。

0 回复 有任何疑惑可以回复我~
  • 提问者 迷茫_坚定 #1
    修改了之后点击保存,tomcat会自动部署,但是还是失败,,,然后,我右击项目名,然后close project ,再open project就可以了
    回复 有任何疑惑可以回复我~ 2017-09-07 13:53:41
  • 修改后不能依赖tomcat自动部署,要手动,在tomcat没启动的时候修改后部署,肯定可以。
    回复 有任何疑惑可以回复我~ 2017-09-07 15:00:42
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信