Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: Resolve MySQL Driver Loading Issue (#6760) #6765

Merged
merged 5 commits into from
Aug 25, 2024

Conversation

lyl2008dsg
Copy link
Contributor

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

This PR resolves the issue of the MySQL driver not loading when starting the apache/seata-server:2.1.0.jre17 Docker image. The fix involves removing the custom classloader setup and relying on the default classloader to handle the MySQL driver loading. Additionally, the MySQL driver jar has been moved from the lib/jdbc directory to the lib directory, simplifying the path and ensuring the driver is loaded properly.

Ⅱ. Does this pull request fix one issue?

fixes #6760

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

The changes made pertain to configuration and environment setup, which are typically validated through deployment tests rather than unit or integration tests. Future contributions could focus on creating automated tests for Docker image configurations to ensure environment consistency.

Ⅳ. Describe how to verify it

To verify this fix:

  1. Ensure the MySQL driver jar is now located in the lib directory.
  2. Start the Seata server using the updated configuration.
  3. Check that the MySQL driver is loaded correctly without any errors during the initialization process.
  4. Optionally, connect to a MySQL database to confirm that database connectivity is functioning correctly.
  5. Additionally, Perform a build using the specific Maven profile:
    • Run mvn clean install -P release-seata to build the project.
    • Navigate to incubator-seata/distribution/target/apache-seata-x.x.x-incubating-bin/apache-seata/bin and execute seata-server.sh.
    • Ensure the application starts up correctly, referring to the application.yml settings for seata.config.type: file, and check the logs to verify that the store.db.driverClassName = com.mysql.cj.jdbc.Driver setting from file.conf is correctly utilized.

Ⅴ. Special notes for reviews

Please focus on the changes made to the classloader behavior and the repositioning of the MySQL driver jar. Confirm that these changes align with best practices for Docker and Java application deployments. Additionally, verify that the removal of custom classloader settings does not inadvertently affect other aspects of the system's behavior.

distribution/NOTICE.md Outdated Show resolved Hide resolved
distribution/NOTICE.md Outdated Show resolved Hide resolved
Copy link

codecov bot commented Aug 18, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 52.22%. Comparing base (64035c5) to head (eb586be).
Report is 2 commits behind head on 2.x.

Files Patch % Lines
...eata/core/store/db/AbstractDataSourceProvider.java 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6765      +/-   ##
============================================
+ Coverage     52.15%   52.22%   +0.06%     
  Complexity     6294     6294              
============================================
  Files          1064     1064              
  Lines         37215    37179      -36     
  Branches       4417     4417              
============================================
+ Hits          19411    19415       +4     
+ Misses        15883    15848      -35     
+ Partials       1921     1916       -5     
Files Coverage Δ
...eata/core/store/db/AbstractDataSourceProvider.java 0.00% <0.00%> (ø)

... and 4 files with indirect coverage changes

@funky-eyes funky-eyes added this to the 2.2.0 milestone Aug 25, 2024
@funky-eyes funky-eyes added type: bug Category issues or prs related to bug. module/server server module labels Aug 25, 2024
Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

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

LGTM

@funky-eyes funky-eyes merged commit 8288a57 into apache:2.x Aug 25, 2024
7 checks passed
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.

启动apache/seata-server:2.1.0.jre17镜像时,无法加载mysql驱动
2 participants