一個糾結了一天的問題,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