查询数据时mybatisplus报错如下
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: Error preparing statement. Cause: java.lang.NullPointerException
使用环境:
shardingsphere-jdbc 5.2.0
mybatis-plus 3.4.3
spring-boot 2.5.0
MGR集群
场景、问题:
查询数据报错
配置文件
databaseName: database_discovery_db
props:
  sql:
    show: true
dataSources:
  ds_0:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://10.0.0.92:3306/dbtest?characterEncoding=utf-8&serverTimezone=UTC
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 3000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
  ds_1:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://10.0.0.93:3306/dbtest?characterEncoding=utf-8&serverTimezone=UTC
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 3000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
  ds_2:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://10.0.0.94:3306/dbtest?characterEncoding=utf-8&serverTimezone=UTC
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 3000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
rules:
  dataSources:
    replica_ds:
      dynamicStrategy:
        autoAwareDataSourceName: readwrite_ds
    readwrite_ds:
      dataSourceNames:
        - ds_0
        - ds_1
        - ds_2
      discoveryHeartbeatName: mgr_heartbeat
      discoveryTypeName: mgr
  discoveryHeartbeats:
    mgr_heartbeat:
      props:
        keep-alive-cron: '0/5 * * * * ?'
  discoveryTypes:
    mgr:
      type: MySQL.MGR
      props:
        group-name: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
测试查询代码

 
      
    