Skip to content

MongoDBAtlasLocalContainer triggers a StackOverflowError #4133

@themadprofessor

Description

@themadprofessor

Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description
When using a MongoDBAtlasLocalContainer with @ServiceConnection, a StackOverflowException is thrown.
It appears to be caused by

org.springframework.ai.testcontainers.service.connection.mongo.MongoDbAtlasLocalContainerConnectionDetailsFactory$MongoDbAtlasLocalContainerConnectionDetails.getSslBundle(MongoDbAtlasLocalContainerConnectionDetailsFactory.java:83)

with the repeated stackframes being:

	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:281)
	at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:265)
	at org.springframework.ai.testcontainers.service.connection.mongo.MongoDbAtlasLocalContainerConnectionDetailsFactory$MongoDbAtlasLocalContainerConnectionDetails.getSslBundle(MongoDbAtlasLocalContainerConnectionDetailsFactory.java:83)

Environment
Spring AI - 1.0.1
Java - 21
Maven - 3.9.10
Atlas containers:

  • mongodb/mongodb-atlas-local:8.0.10
  • mongodb/mongodb-atlas-local:latest

Steps to reproduce

  1. Create project in Spring Initializer with:
    • Testcontainers
    • MonogoDB Atlas Vector Database
  2. Run mvn test

Expected behavior
No StackOverflowException and for the container to be used.

Minimal Complete Reproducible example
Minimal example

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions