pagehelper / Mybatis-PageHelper

Mybatis通用分页插件
https://mybatis.io
MIT License
12.18k stars 3.13k forks source link

在系统中发现了多个分页插件,请检查系统配置! #471

Closed llyboy closed 2 years ago

llyboy commented 4 years ago

异常模板

使用环境

SQL 解析错误

分页参数

PageHelper.startPage(1, 10);
xxMapper.select(model);

原 SQL

select * from xxx where xxx = xxx

期望的结果:

select * from xxx where xxx = xxx limit 10

完整异常信息

|2019-12-09 20:33:19.412|ERROR|jobSequenceSettlementAuthTask_Worker-1|com.epay.fcc.fses.settlement.service.impl.auth.AbstractAuthBizService:149||||||||process channel data is error, error reason==>| org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

Error querying database. Cause: java.lang.RuntimeException: 在系统中发现了多个分页插件,请检查系统配置!

Cause: java.lang.RuntimeException: 在系统中发现了多个分页插件,请检查系统配置!

at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77) ~[mybatis-spring-1.3.1.jar:1.3.1]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) ~[mybatis-spring-1.3.1.jar:1.3.1]
at com.sun.proxy.$Proxy139.selectList(Unknown Source) ~[?:?]
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230) ~[mybatis-spring-1.3.1.jar:1.3.1]
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:137) ~[mybatis-3.4.5.jar:3.4.5]
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75) ~[mybatis-3.4.5.jar:3.4.5]
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) ~[mybatis-3.4.5.jar:3.4.5]
at com.sun.proxy.$Proxy148.queryAuthCountResult(Unknown Source) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) ~[spring-aop-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:197) ~[spring-aop-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at com.alibaba.druid.support.spring.stat.DruidStatInterceptor.invoke(DruidStatInterceptor.java:73) ~[druid-1.1.20.jar:1.1.20]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) ~[spring-aop-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at com.sun.proxy.$Proxy149.queryAuthCountResult(Unknown Source) ~[?:?]
at com.epay.fcc.fses.settlement.service.impl.auth.AbstractAuthBizService.processBizData(AbstractAuthBizService.java:113) [classes/:?]
at com.epay.fcc.fses.settlement.service.impl.auth.impl.SettlementAuthServiceImpl.processData(SettlementAuthServiceImpl.java:63) [classes/:?]
at com.epay.fcc.fses.settlement.service.impl.auth.impl.SettlementAuthServiceImpl$$FastClassBySpringCGLIB$$9fbf3f7f.invoke(<generated>) [classes/:?]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) [spring-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:747) [spring-aop-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) [spring-aop-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at com.alibaba.druid.support.spring.stat.DruidStatInterceptor.invoke(DruidStatInterceptor.java:73) [druid-1.1.20.jar:1.1.20]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) [spring-aop-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689) [spring-aop-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at com.epay.fcc.fses.settlement.service.impl.auth.impl.SettlementAuthServiceImpl$$EnhancerBySpringCGLIB$$6f6ffcd8.processData(<generated>) [classes/:?]
at com.epay.fcc.fses.settlement.job.auth.JobSequenceSettlementAuthTask.processData(JobSequenceSettlementAuthTask.java:72) [classes/:?]
at com.dangdang.ddframe.job.executor.type.DataflowJobExecutor.processData(DataflowJobExecutor.java:75) [elastic-job-common-core-2.1.5.jar:?]
at com.dangdang.ddframe.job.executor.type.DataflowJobExecutor.oneOffExecute(DataflowJobExecutor.java:66) [elastic-job-common-core-2.1.5.jar:?]
at com.dangdang.ddframe.job.executor.type.DataflowJobExecutor.process(DataflowJobExecutor.java:48) [elastic-job-common-core-2.1.5.jar:?]
at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.process(AbstractElasticJobExecutor.java:206) [elastic-job-common-core-2.1.5.jar:?]
at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.process(AbstractElasticJobExecutor.java:171) [elastic-job-common-core-2.1.5.jar:?]
at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.execute(AbstractElasticJobExecutor.java:150) [elastic-job-common-core-2.1.5.jar:?]
at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.execute(AbstractElasticJobExecutor.java:122) [elastic-job-common-core-2.1.5.jar:?]
at com.dangdang.ddframe.job.lite.internal.schedule.LiteJob.execute(LiteJob.java:26) [elastic-job-lite-core-2.1.5.jar:?]
at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-2.3.0.jar:?]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.3.0.jar:?]

Caused by: org.apache.ibatis.exceptions.PersistenceException:

Error querying database. Cause: java.lang.RuntimeException: 在系统中发现了多个分页插件,请检查系统配置!

Cause: java.lang.RuntimeException: 在系统中发现了多个分页插件,请检查系统配置!

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) ~[mybatis-3.4.5.jar:3.4.5]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150) ~[mybatis-3.4.5.jar:3.4.5]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) ~[mybatis-3.4.5.jar:3.4.5]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) ~[mybatis-spring-1.3.1.jar:1.3.1]
... 38 more

Caused by: java.lang.RuntimeException: 在系统中发现了多个分页插件,请检查系统配置! at com.github.pagehelper.PageHelper.skip(PageHelper.java:55) ~[pagehelper-5.1.2.jar:?] at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:92) ~[pagehelper-5.1.2.jar:?] at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) ~[mybatis-3.4.5.jar:3.4.5] at com.sun.proxy.$Proxy191.query(Unknown Source) ~[?:?] at com.github.pagehelper.PageInterceptor.executeAutoCount(PageInterceptor.java:201) ~[pagehelper-5.1.2.jar:?] at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:113) ~[pagehelper-5.1.2.jar:?] at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) ~[mybatis-3.4.5.jar:3.4.5] at com.sun.proxy.$Proxy191.query(Unknown Source) ~[?:?] at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) ~[mybatis-3.4.5.jar:3.4.5] at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) ~[mybatis-3.4.5.jar:3.4.5] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181] at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) ~[mybatis-spring-1.3.1.jar:1.3.1] ... 38 more

异常信息放在这里

Caused by: java.lang.RuntimeException: 在系统中发现了多个分页插件,请检查系统配置!

其他类型的错误

com.github.pagehelper pagehelper-spring-boot-starter 1.2.5

spring boot 2.0.1 只配置了

分页插件

pagehelper: helperDialect: oracle reasonable: true supportMethodsArguments: false pageSizeZero: true params: count=countSql 一直报上面错误:在系统中发现了多个分页插件,请检查系统配置!

功能建议

详细说明,尽可能提供(伪)代码示例。

dingziyang commented 4 years ago

我也一样

abel533 commented 2 years ago

新版本启动中增加 banner, 需要日志级别 debug,可以通过 -Dpagehelper.banner=false 或者环境变量 PAGEHELPER_BANNER=false 关闭:

DEBUG [main] - 

,------.                           ,--.  ,--.         ,--.                         
|  .--. '  ,--,--.  ,---.   ,---.  |  '--'  |  ,---.  |  |  ,---.   ,---.  ,--.--. 
|  '--' | ' ,-.  | | .-. | | .-. : |  .--.  | | .-. : |  | | .-. | | .-. : |  .--' 
|  | --'  \ '-'  | ' '-' ' \   --. |  |  |  | \   --. |  | | '-' ' \   --. |  |    
`--'       `--`--' .`-  /   `----' `--'  `--'  `----' `--' |  |-'   `----' `--'    
                   `---'                                   `--'                        is intercepting.

通过这个输出可以看到分页插件配置了几次,默认只会输出一次。。

如果出现了多次,可以在 PageInterceptor 构造方法断点看看那些地方进行了实例化。