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

optimize: optimize database driver cannot found message(#6760) #6791

Closed
wants to merge 0 commits into from

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.

Copy link

codecov bot commented Aug 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.19%. Comparing base (3bb8f73) to head (0d61467).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##                2.x    #6791   +/-   ##
=========================================
  Coverage     52.18%   52.19%           
- Complexity     6311     6312    +1     
=========================================
  Files          1067     1067           
  Lines         37278    37278           
  Branches       4427     4427           
=========================================
+ Hits          19455    19457    +2     
+ Misses        15890    15889    -1     
+ Partials       1933     1932    -1     
Files with missing lines Coverage Δ
...eata/core/store/db/AbstractDataSourceProvider.java 0.00% <ø> (ø)

... and 1 file with indirect coverage changes

@slievrly slievrly changed the title bugfix: Resolve MySQL Driver Loading Issue (#6760) optimize: optimize database driver cannot found message(#6760) Aug 28, 2024
@funky-eyes funky-eyes added this to the 2.2.0 milestone Aug 29, 2024
@@ -26,8 +26,9 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6757](https://github.com/apache/incubator-seata/pull/6757)] the bug where multiple nodes cannot be retrieved from the naming server
- [[#6769](https://github.com/apache/incubator-seata/pull/6769)] fix tcc fence deadLock
- [[#6778](https://github.com/apache/incubator-seata/pull/6778)] fix namingserver node term
- [[#6765](https://github.com/apache/incubator-seata/pull/6765)] fix MySQL driver loading by replacing custom classloader with system classloader for better compatibility and simplified process
- [[#6760](https://github.com/apache/incubator-seata/pull/6765)] fix MySQL driver loading by replacing custom classloader with system classloader for better compatibility and simplified process
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- [[#6760](https://github.com/apache/incubator-seata/pull/6765)] fix MySQL driver loading by replacing custom classloader with system classloader for better compatibility and simplified process
- [[#6765](https://github.com/apache/incubator-seata/pull/6765)] fix MySQL driver loading by replacing custom classloader with system classloader for better compatibility and simplified process

- [[#6781](https://github.com/apache/incubator-seata/pull/6781)] the issue where the TC occasionally fails to go offline from the NamingServer
- [[#6760](https://github.com/apache/incubator-seata/pull/6791)] make exception message generic for all database drivers
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- [[#6760](https://github.com/apache/incubator-seata/pull/6791)] make exception message generic for all database drivers
- [[#6791](https://github.com/apache/incubator-seata/pull/6791)] make exception message generic for all database drivers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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