OpenSearch icon indicating copy to clipboard operation
OpenSearch copied to clipboard

Set context class loader to plugin's class loader when creating kafka consumer

Open bugmakerrrrrr opened this issue 7 months ago • 3 comments

Description

Set context class loader to plugin's class loader when creating kafka consumer to avoid ClassNotFoundException. For example, when configuring SASL authentication in Kafka, the java.base/javax.security.auth.login.LoginContext needs to new a org.apache.kafka.common.security.plain.PlainLoginModule instance, but the class PlainLoginModule is loaded by class loader of KafkaPlugin, so a ClassNotFoundException would be thrown.

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • [x] Functionality includes testing.
  • [x] API changes companion pull request created, if applicable.
  • [x] Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.

bugmakerrrrrr avatar May 14 '25 17:05 bugmakerrrrrr

:white_check_mark: Gradle check result for 7d9cdd6e6b4806d4c118da04942bc52e62fd10b9: SUCCESS

github-actions[bot] avatar May 14 '25 18:05 github-actions[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 72.49%. Comparing base (a7b3d97) to head (7d9cdd6). :warning: Report is 321 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #18297      +/-   ##
============================================
- Coverage     72.56%   72.49%   -0.07%     
+ Complexity    67391    67362      -29     
============================================
  Files          5488     5488              
  Lines        311030   311033       +3     
  Branches      45216    45216              
============================================
- Hits         225687   225478     -209     
- Misses        66916    67159     +243     
+ Partials      18427    18396      -31     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar May 14 '25 18:05 codecov[bot]

This PR is stalled because it has been open for 30 days with no activity.