Sherlock-4869 commented on issue #24880:
URL: 
https://github.com/apache/shardingsphere/issues/24880#issuecomment-1488012859

   sorry, I can't reappear it when I use sharding jdbc 5.2.1 in a demo project, 
so I think this is a compatibility issue with other frameworks,such as 
mybatis-plus, shiro and so on.
   
   So I later use sharding jdbc 5.1.2, other issues arise at this time, it 
occrus NullPointerException.
   
   Trace the source code back. It occrus in this line in 
'ClassBasedShardingAlgorithm'
   
   
![image](https://user-images.githubusercontent.com/75062359/228443988-951e030f-b1e2-418d-977a-ac94514b5eaf.png)
   
   I think it doesn't Inject my algorithm class normally.
   
   My yaml like this:
   
   `
   spring:
     shardingsphere:
       datasource:
         names: ds0
         ds0:
           type: com.alibaba.druid.pool.DruidDataSource
           driver-class-name: com.mysql.cj.jdbc.Driver
           url: 
"jdbc:mysql://172.18.100.87:3306/eeyes_energy?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT"
           username: root
           password: hgny
           initial-size: 10
           max-active: 100
           min-idle: 10
           max-wait: 60000
           pool-prepared-statements: true
           max-pool-prepared-statement-per-connection-size: 20
           time-between-eviction-runs-millis: 60000
           min-evictable-idle-time-millis: 300000
           test-while-idle: true
           test-on-borrow: false
           test-on-return: false
           stat-view-servlet:
             enabled: true
             url-pattern: /druid/*
             #login-username: admin
             #login-password: admin
           filter:
             stat:
               log-slow-sql: true
               slow-sql-millis: 1000
               merge-sql: false
             wall:
               config:
                 multi-statement-allow: true
   
       rules:
         sharding:
           tables:
             data_energy_15min:
               actual-data-nodes: 
ds0.data_energy_15min_$->{2020..2030}${(1..12).collect{t->t.toString().padLeft(2,'0')}}
               table-strategy:
                 standard:
                   sharding-column: stat_date_time
                   sharding-algorithm-name: dateTime
           sharding-algorithms:
             dateTime:
               type: CLASS_BASED
               props:
                 strategy: STANDARD
                 algorithmClassName: 
com.hgny.energy.module.data.sharding.StatTimeShardingAlgorithm
       props:
         sql-show: true
   `
   
   
![image](https://user-images.githubusercontent.com/75062359/228444485-2e601b56-374a-430a-b525-a37372b8785d.png)
   
   Can you spot any problems, please.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to