一个纠结了一天的问题,idea整合ssm,在使用mybatis的时候,总是提示容器无法加载dao,开始搜索无法加载dao层怎么办;
然后检查了所有的注解和代码,并没有发现什么代码错误。
然后仔细查看分析了一下我的log日志,把错误都挑出来了,发现所有的错误都有pagehelper,然后猜测是它的问题,教程里是4.1.6,但是maven导入不进去,它自己无法下载,然后就是了4.1.5,可以下载,顺便也下载了jsphelper0.9.5,因为看网上说这俩要一起用。然后试了一下重新发布!成功!
版本号杀我,阿弥陀佛
03-Oct-2019 21:36:55.220 警告 [RMI TCP Connection(3)-127.0.0.1] org.springframework.web.context.support.XmlWebApplicationContext.refresh Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userFunctionImpl': Unsatisfied dependency expressed through field 'uDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in file [D:\IDEA\workSpace\VIP\target\VIP\WEB-INF\classes\com\leilin\vip\dao\UserDao.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-context.xml]: Invocation of init method failed; nested exception is 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: java.lang.ClassCastException: com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor
03-Oct-2019 21:36:55.228 严重 [RMI TCP Connection(3)-127.0.0.1] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userFunctionImpl': Unsatisfied dependency expressed through field 'uDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in file [D:\IDEA\workSpace\VIP\target\VIP\WEB-INF\classes\com\leilin\vip\dao\UserDao.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-context.xml]: Invocation of init method failed; nested exception is 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: java.lang.ClassCastException: com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'userDao' defined in file
[D:\IDEA\workSpace\VIP\target\VIP\WEB-INF\classes\com\leilin\vip\dao\UserDao.class]:
Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory';
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-context.xml]: Invocation of init method failed; nested exception is 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: java.lang.ClassCastException: com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-context.xml]:
Invocation of init method failed;
nested exception is 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: java.lang.ClassCastException:
com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor
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: java.lang.ClassCastException:
com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor
Caused by: org.apache.ibatis.builder.BuilderException:
Error parsing SQL Mapper Configuration.
Cause: java.lang.ClassCastException:
com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor
Caused by: java.lang.ClassCastException:
com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor