diguage opened a new issue, #7499:
URL: https://github.com/apache/incubator-seata/issues/7499

   ### Check Ahead
   
   - [x] I have searched the [issues](https://github.com/seata/seata/issues) of 
this repository and believe that this is not a duplicate.
   
   - [ ] I am willing to try to fix this bug myself.
   
   
   ### Ⅰ. Issue Description
   
   I run the latest code, and if I use the `datasource: druid` configuration 
item, it can start normally. If I use `datasource: hikari`, an error is thrown.
   
   The config file:
   
   ```yaml
   server:
     port: 8091
   spring:
     application:
       name: seata-server
     main:
       web-application-type: none
   logging:
     config: classpath:logback-spring.xml
     file:
       path: ${log.home:${user.home}/logs/seata}
   
   seata:
     config:
       # support: nacos, consul, apollo, zk, etcd3
       type: file
     registry:
       # support: nacos, eureka, redis, zk, consul, etcd3, sofa
       type: file
     store:
       # support: file 、 db 、 redis 、 raft
       mode: db
       session:
         mode: db
       lock:
         mode: db
       db:
         # If use druid, it is OK. If change to hikari, and then threw an error.
         datasource: hikari
         db-type: mysql
         driver-class-name: com.mysql.cj.jdbc.Driver
         url: 
jdbc:mysql://localhost:3396/db_seata?useUnicode=true&characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
         user: admin_seata
         password: 123456
         min-conn: 10
         max-conn: 100
         global-table: global_table
         branch-table: branch_table
         lock-table: lock_table
         distributed-lock-table: distributed_lock
         vgroup-table: vgroup_table
         query-limit: 1000
         max-wait: 5000
         druid:
           time-between-eviction-runs-millis: 120000
           min-evictable-idle-time-millis: 300000
           test-while-idle: true
           test-on-borrow: false
           keep-alive: false
         hikari:
           idle-timeout: 600000
           keepalive-time: 120000
           max-lifetime: 1800000
           validation-timeout: 5000
     #  server:
     #    service-port: 8091 #If not configured, the default is '${server.port} 
+ 1000'
   
   ```
   
   
   
   ### Ⅱ. Describe what happened
   
   ### If I use the `datasource: druid` configuration item, it can start 
normally. 
   
   ```
   mysql> SHOW FULL PROCESSLIST;
   
╔══════╤═════════════════╤════════════════════╤══════════╤═════════╤═══════╤════════════════════════════╤═══════════════════════╗
   ║ Id   │ User            │ Host               │ db       │ Command │ Time  │ 
State                      │ Info                  ║
   
╟──────┼─────────────────┼────────────────────┼──────────┼─────────┼───────┼────────────────────────────┼───────────────────────╢
   ║    5 │ event_scheduler │ localhost          │ NULL     │ Daemon  │ 75671 │ 
Waiting on empty queue     │ NULL                  ║
   ║  330 │ root            │ 192.168.65.1:18003 │ NULL     │ Query   │     0 │ 
init                       │ SHOW FULL PROCESSLIST ║
   ║ 1183 │ admin_seata     │ 192.168.65.1:56665 │ db_seata │ Sleep   │   118 │ 
                           │ NULL                  ║
   ║ 1184 │ admin_seata     │ 192.168.65.1:64633 │ db_seata │ Sleep   │   118 │ 
                           │ NULL                  ║
   ║ 1185 │ admin_seata     │ 192.168.65.1:16616 │ db_seata │ Sleep   │   118 │ 
                           │ NULL                  ║
   ║ 1186 │ admin_seata     │ 192.168.65.1:56590 │ db_seata │ Sleep   │   118 │ 
                           │ NULL                  ║
   ║ 1187 │ admin_seata     │ 192.168.65.1:47308 │ db_seata │ Query   │     0 │ 
waiting for handler commit │ COMMIT                ║
   ║ 1188 │ admin_seata     │ 192.168.65.1:44028 │ db_seata │ Sleep   │     0 │ 
                           │ NULL                  ║
   ║ 1189 │ admin_seata     │ 192.168.65.1:40124 │ db_seata │ Sleep   │     0 │ 
                           │ NULL                  ║
   ║ 1190 │ admin_seata     │ 192.168.65.1:42419 │ db_seata │ Sleep   │     5 │ 
                           │ NULL                  ║
   ║ 1191 │ admin_seata     │ 192.168.65.1:65168 │ db_seata │ Sleep   │     0 │ 
                           │ NULL                  ║
   ║ 1192 │ admin_seata     │ 192.168.65.1:55653 │ db_seata │ Sleep   │    11 │ 
                           │ NULL                  ║
   
╚══════╧═════════════════╧════════════════════╧══════════╧═════════╧═══════╧════════════════════════════╧═══════════════════════╝
   ```
   
   If I use `datasource: hikari`, an error is thrown.
   
   ```
   Caused by: java.lang.RuntimeException: Failed to load driver class 
com.mysql.cj.jdbc.Driver in either of HikariConfig class loader or Thread 
context classloader
        at 
com.zaxxer.hikari.HikariConfig.setDriverClassName(HikariConfig.java:491)
        at 
org.apache.seata.server.store.HikariDataSourceProvider.doGenerate(HikariDataSourceProvider.java:55)
        at 
org.apache.seata.core.store.db.AbstractDataSourceProvider.generate(AbstractDataSourceProvider.java:85)
        at 
org.apache.seata.core.store.db.AbstractDataSourceProvider.init(AbstractDataSourceProvider.java:75)
        at 
org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader.initInstance(EnhancedServiceLoader.java:724)
        at 
org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader.createNewExtension(EnhancedServiceLoader.java:492)
   ```
   
   ### Ⅲ. Describe what you expected to happen
   
   Start up normally
   
   ### Ⅳ. How to reproduce it (as minimally and precisely as possible)
   
   _No response_
   
   ### Ⅴ. Anything else we need to know?
   
   I read the code: `HikariDataSourceProvider`, `DruidDataSourceProvider` and 
`DbcpDataSourceProvider`. 
   
   HikariCP does not set the driver class loader.
   
   ### Ⅵ. Environment
   
   - The 2.x branch
   - Corretto-21.0.7.6.1 (build 21.0.7+6-LTS)


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to