Skip to content

Conversation

@maple525866
Copy link
Contributor

@maple525866 maple525866 commented Jul 6, 2025

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

Since Druid has setDriverClassLoader(getDriverClassLoader()), and HikariConfig has no corresponding API, Druid can set the driver class loader normally, but Hikari cannot set the class loader directly.

Here is my solution:
By calling the method of the abstract parent class, get the driver class loader, explicitly load and register the driver to DriverManager, and finally configure HikariConfig to solve this problem.
And use two test methods to test different MySQL driver situations to verify whether they can be loaded correctly.

Ⅱ. Does this pull request fix one issue?

fixes #7499

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

mvn clean test
Add two test methods based on the original AbstractDataSourceProviderTest test class to test whether different MySQL version drivers are loaded correctly

Ⅴ. Special notes for reviews

maple added 2 commits July 6, 2025 17:28
@codecov
Copy link

codecov bot commented Jul 6, 2025

Codecov Report

Attention: Patch coverage is 65.38462% with 9 lines in your changes missing coverage. Please review.

Project coverage is 60.41%. Comparing base (e096c74) to head (df4c8c2).
Report is 2 commits behind head on 2.x.

Files with missing lines Patch % Lines
...e/seata/server/store/HikariDataSourceProvider.java 65.38% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #7504      +/-   ##
============================================
+ Coverage     60.40%   60.41%   +0.01%     
- Complexity      658      662       +4     
============================================
  Files          1284     1298      +14     
  Lines         48465    49080     +615     
  Branches       5694     5770      +76     
============================================
+ Hits          29276    29654     +378     
- Misses        16572    16793     +221     
- Partials       2617     2633      +16     
Files with missing lines Coverage Δ
...e/seata/server/store/HikariDataSourceProvider.java 77.58% <65.38%> (-11.31%) ⬇️

... and 10 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@funky-eyes funky-eyes added this to the 2.5.0 milestone Jul 7, 2025
@funky-eyes funky-eyes added type: bug Category issues or prs related to bug. module/server server module labels Jul 7, 2025
@slievrly slievrly self-requested a review July 8, 2025 06:48
@slievrly slievrly changed the title bugfix: fixed the problem of not being able to load driver class in Hikari bugfix: fix load driver class in Hikari Jul 9, 2025
@slievrly
Copy link
Member

slievrly commented Jul 9, 2025

@maple525866
Copy link
Contributor Author

Pls add change log.

done

Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@slievrly slievrly merged commit a18e999 into apache:2.x Jul 9, 2025
10 checks passed
slievrly pushed a commit to slievrly/fescar that referenced this pull request Oct 21, 2025
YvCeung pushed a commit to YvCeung/incubator-seata that referenced this pull request Dec 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module/server server module type: bug Category issues or prs related to bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to load driver class com.mysql.cj.jdbc.Driver in either of HikariConfig class loader or Thread context classloader

3 participants