Fix IllegalAccessException in MongoDbAtlasLocalContainerConnectionDetails.getSslBundle()#4186
Closed
markpollack wants to merge 1 commit intomainfrom
Closed
Fix IllegalAccessException in MongoDbAtlasLocalContainerConnectionDetails.getSslBundle()#4186markpollack wants to merge 1 commit intomainfrom
markpollack wants to merge 1 commit intomainfrom
Conversation
…ails.getSslBundle() The original fix in commit 03d475e introduced a MethodHandles.unreflectSpecial() approach to resolve a StackOverflowError, but this caused IllegalAccessException due to incorrect usage of unreflectSpecial() for interface default methods. The unreflectSpecial() method is designed for superclass method calls, not interface default methods, and requires private access which caused: "IllegalAccessException: no private access for invokespecial: interface org.springframework.boot.autoconfigure.mongo.MongoConnectionDetails" This fix replaces the complex reflection approach with simple interface delegation using 'MongoConnectionDetails.super.getSslBundle()'. This solution: - Eliminates IllegalAccessException by properly overriding with public access - Avoids StackOverflowError by delegating to interface default method - Removes all reflection code, making it simpler and more maintainable - Works across all Spring Boot versions without version-specific checks - Resolves access privilege conflict between interface and parent class The interface default method returns null, which is the desired behavior for SSL configuration when no custom SSL bundle is provided. Fixes: https://github.com/spring-projects/spring-ai/actions/runs/16981113833 Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
sunyuhan1998
approved these changes
Aug 20, 2025
Contributor
|
Is it compatible with Spring Boot 3.4.x? |
Member
Author
|
well i only tested on 3.4... we don't yet have a build for 4... |
Contributor
Then it's safe, I will close GH-4175. |
Contributor
|
Member
Author
|
thanks, let me validate all this correctly tomorrow. i was looking for an easy solution to 'patch' vs using reflection. |
Contributor
|
@markpollack I think #4175 should be reopen since you close this one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes IllegalAccessException when calling getSslBundle() method in MongoDbAtlasLocalContainerConnectionDetails.
Summary
This PR resolves an IllegalAccessException that occurs when accessing the SSL bundle in MongoDB Atlas container connection details.
Changes
Test Plan
This is a clean recreation of the original PR #4183 to resolve rebase conflicts caused by stale branch history.