pagehelper / pagehelper-spring-boot

pagehelper-spring-boot
MIT License
1.55k stars 312 forks source link

升级到最新版本后出现PageHelperAutoConfiguration Bad return type #173

Open Lu-Lucifer opened 9 months ago

Lu-Lucifer commented 9 months ago

错误内容:Error creating bean with name 'com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration': Bad return type mybatis:3.5.5 pagehelper-spring-boot-starter:2.1.0

在将pagehelper-spring-boot-starter修改为2.0.0后错误消失,能正常运行了 希望能尽快修复错误内容

pagehelper commented 9 months ago

信息太少,需要提供更多堆栈信息。

lichong-a commented 8 months ago

springboot 3.2.1 mybatis-plus 3.5.5 pagehelper-spring-boot 2.1.0 报错如下:

2024-02-27 18:45:34 [restartedMain] WARN  org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext [AbstractApplicationContext.java:633] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration': Bad return type
Exception Details:
  Location:
    com/github/pagehelper/parser/defaults/DefaultCountSqlParser.sqlToCount(Lnet/sf/jsqlparser/statement/select/Select;Ljava/lang/String;)Lnet/sf/jsqlparser/statement/select/Select; @149: areturn
  Reason:
    Type 'net/sf/jsqlparser/statement/select/PlainSelect' (current frame, stack[0]) is not assignable to 'net/sf/jsqlparser/statement/select/Select' (from method signature)
  Current Frame:
    bci: @149
    flags: { }
    locals: { 'com/github/pagehelper/parser/defaults/DefaultCountSqlParser', 'net/sf/jsqlparser/statement/select/Select', 'java/lang/String', 'java/util/List', 'net/sf/jsqlparser/statement/select/PlainSelect', 'net/sf/jsqlparser/statement/select/ParenthesedSelect' }
    stack: { 'net/sf/jsqlparser/statement/select/PlainSelect' }
  Bytecode:
    0000000: bb00 2959 b700 2a4e 2dbb 002b 59bb 002c
    0000010: 59bb 001f 59b7 0020 122d b600 212c b600
    0000020: 2112 2eb6 0021 b600 22b7 002f b700 30b9
    0000030: 0031 0200 572b c100 1599 0018 2a2b c000
    0000040: 15b6 0032 9900 0d2b c000 152d b600 332b
    0000050: b0bb 0015 59b7 0034 3a04 bb00 3559 b700
    0000060: 363a 0519 052b b600 3719 05b2 0038 b600
    0000070: 3919 0419 05b6 003a 1904 2db6 0033 2bb6
    0000080: 0011 c600 1119 042b b600 11b6 003b 2b01
    0000090: b600 3c19 04b0                         
  Stackmap Table:
    append_frame(@81,Object[#169])
    append_frame(@147,Object[#170],Object[#171])

2024-02-27 18:45:34 [restartedMain] INFO  org.quartz.core.QuartzScheduler [QuartzScheduler.java:666] Scheduler quartzScheduler_$_NON_CLUSTERED shutting down. 
2024-02-27 18:45:34 [restartedMain] INFO  org.quartz.core.QuartzScheduler [QuartzScheduler.java:585] Scheduler quartzScheduler_$_NON_CLUSTERED paused. 
2024-02-27 18:45:34 [restartedMain] INFO  org.quartz.core.QuartzScheduler [QuartzScheduler.java:740] Scheduler quartzScheduler_$_NON_CLUSTERED shutdown complete. 
2024-02-27 18:45:34 [restartedMain] INFO  sys-user [ShutdownManager.java:31] ====关闭后台任务任务线程池==== 
2024-02-27 18:45:34 [restartedMain] WARN  org.springframework.context.annotation.CommonAnnotationBeanPostProcessor [InitDestroyAnnotationBeanPostProcessor.java:247] Destroy method on bean with name 'shutdownManager' threw an exception: java.lang.ExceptionInInitializerError 
2024-02-27 18:45:34 [restartedMain] INFO  com.alibaba.druid.pool.DruidDataSource [DruidDataSource.java:2212] {dataSource-1} closing ... 
2024-02-27 18:45:34 [restartedMain] INFO  com.alibaba.druid.pool.DruidDataSource [DruidDataSource.java:2285] {dataSource-1} closed 
2024-02-27 18:45:34 [restartedMain] INFO  org.apache.catalina.core.StandardService [DirectJDKLog.java:173] Stopping service [Tomcat] 
2024-02-27 18:45:34 [restartedMain] ERROR org.springframework.boot.SpringApplication [SpringApplication.java:855] Application run failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration': Bad return type
Exception Details:
  Location:
    com/github/pagehelper/parser/defaults/DefaultCountSqlParser.sqlToCount(Lnet/sf/jsqlparser/statement/select/Select;Ljava/lang/String;)Lnet/sf/jsqlparser/statement/select/Select; @149: areturn
  Reason:
    Type 'net/sf/jsqlparser/statement/select/PlainSelect' (current frame, stack[0]) is not assignable to 'net/sf/jsqlparser/statement/select/Select' (from method signature)
  Current Frame:
    bci: @149
    flags: { }
    locals: { 'com/github/pagehelper/parser/defaults/DefaultCountSqlParser', 'net/sf/jsqlparser/statement/select/Select', 'java/lang/String', 'java/util/List', 'net/sf/jsqlparser/statement/select/PlainSelect', 'net/sf/jsqlparser/statement/select/ParenthesedSelect' }
    stack: { 'net/sf/jsqlparser/statement/select/PlainSelect' }
  Bytecode:
    0000000: bb00 2959 b700 2a4e 2dbb 002b 59bb 002c
    0000010: 59bb 001f 59b7 0020 122d b600 212c b600
    0000020: 2112 2eb6 0021 b600 22b7 002f b700 30b9
    0000030: 0031 0200 572b c100 1599 0018 2a2b c000
    0000040: 15b6 0032 9900 0d2b c000 152d b600 332b
    0000050: b0bb 0015 59b7 0034 3a04 bb00 3559 b700
    0000060: 363a 0519 052b b600 3719 05b2 0038 b600
    0000070: 3919 0419 05b6 003a 1904 2db6 0033 2bb6
    0000080: 0011 c600 1119 042b b600 11b6 003b 2b01
    0000090: b600 3c19 04b0                         
  Stackmap Table:
    append_frame(@81,Object[#169])
    append_frame(@147,Object[#170],Object[#171])

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1773)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:960)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:464)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:334)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1358)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1347)
    at com.eoi.UCenterApplication.main(UCenterApplication.java:27)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50)
Caused by: java.lang.VerifyError: Bad return type
Exception Details:
  Location:
    com/github/pagehelper/parser/defaults/DefaultCountSqlParser.sqlToCount(Lnet/sf/jsqlparser/statement/select/Select;Ljava/lang/String;)Lnet/sf/jsqlparser/statement/select/Select; @149: areturn
  Reason:
    Type 'net/sf/jsqlparser/statement/select/PlainSelect' (current frame, stack[0]) is not assignable to 'net/sf/jsqlparser/statement/select/Select' (from method signature)
  Current Frame:
    bci: @149
    flags: { }
    locals: { 'com/github/pagehelper/parser/defaults/DefaultCountSqlParser', 'net/sf/jsqlparser/statement/select/Select', 'java/lang/String', 'java/util/List', 'net/sf/jsqlparser/statement/select/PlainSelect', 'net/sf/jsqlparser/statement/select/ParenthesedSelect' }
    stack: { 'net/sf/jsqlparser/statement/select/PlainSelect' }
  Bytecode:
    0000000: bb00 2959 b700 2a4e 2dbb 002b 59bb 002c
    0000010: 59bb 001f 59b7 0020 122d b600 212c b600
    0000020: 2112 2eb6 0021 b600 22b7 002f b700 30b9
    0000030: 0031 0200 572b c100 1599 0018 2a2b c000
    0000040: 15b6 0032 9900 0d2b c000 152d b600 332b
    0000050: b0bb 0015 59b7 0034 3a04 bb00 3559 b700
    0000060: 363a 0519 052b b600 3719 05b2 0038 b600
    0000070: 3919 0419 05b6 003a 1904 2db6 0033 2bb6
    0000080: 0011 c600 1119 042b b600 11b6 003b 2b01
    0000090: b600 3c19 04b0                         
  Stackmap Table:
    append_frame(@81,Object[#169])
    append_frame(@147,Object[#170],Object[#171])

    at com.github.pagehelper.dialect.AbstractDialect.setProperties(AbstractDialect.java:57)
    at com.github.pagehelper.dialect.AbstractHelperDialect.setProperties(AbstractHelperDialect.java:233)
    at com.github.pagehelper.page.PageAutoDialect.instanceDialect(PageAutoDialect.java:207)
    at com.github.pagehelper.page.PageAutoDialect.setProperties(PageAutoDialect.java:352)
    at com.github.pagehelper.PageHelper.setProperties(PageHelper.java:188)
    at com.github.pagehelper.PageInterceptor.setProperties(PageInterceptor.java:263)
    at com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration.afterPropertiesSet(PageHelperAutoConfiguration.java:65)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1820)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1769)
    ... 21 common frames omitted
2024-02-27 18:45:35 [Thread-5] WARN  com.alibaba.nacos.common.http.HttpClientBeanHolder [HttpClientBeanHolder.java:102] [HttpClientBeanHolder] Start destroying common HttpClient 
2024-02-27 18:45:35 [Thread-11] WARN  com.alibaba.nacos.common.notify.NotifyCenter [NotifyCenter.java:134] [NotifyCenter] Start destroying Publisher 
2024-02-27 18:45:35 [Thread-11] WARN  com.alibaba.nacos.common.notify.NotifyCenter [NotifyCenter.java:151] [NotifyCenter] Destruction of the end 
2024-02-27 18:45:35 [Thread-5] WARN  com.alibaba.nacos.common.http.HttpClientBeanHolder [HttpClientBeanHolder.java:111] [HttpClientBeanHolder] Destruction of the end 
lichong-a commented 8 months ago

经过排查是jsqlparser和pagehelper版本冲突导致

bchengwang commented 8 months ago

经过排查是jsqlparser和pagehelper版本冲突导致

看看有设置这个参数吗去掉就好了 pagehelper: helperDialect: mysql

liangAhh commented 7 months ago

pagehelper-spring-boot 2.1.0 降到 2.0.0 版本就可以了

LSL1618 commented 6 months ago

@lichong-a ,我也碰到了一样的报错 https://github.com/pagehelper/Mybatis-PageHelper/issues/814,使用pagehelper-spring-boot2.1.0搭配jsqlparser4.5的情况下,war包在独立的tomcat启动时报错,然而在IDEA中启动却正常,这就很迷惑。我之所以不用jsqlparser4.7是因为他解析部分分页SQL会报错,有兼容性问题。