Class loading fails on an interrupted thread causing com.mongodb.event.ServerClosedEvent to fail to load when Mongo detects a cluster change
manjian14 opened this issue · 29 comments
We've encountered a connectivity problem after migrating from Spring Boot 3.1.5/3.1.6 to 3.2.0. The error log points to a missing class:
java.lang.ClassNotFoundException: com.mongodb.event.ServerClosedEvent
This is affecting our connection to MongoDB "AWS DocumentDB." Any guidance or resolution on this matter would be greatly appreciated.
Hello!
I can't see any code from Boot in the stacktrace, besides the JAR loader. I'm not sure if this has something to do with the Uber JAR rewrite. Can you please try with the classic loader implementation and report back if that fixes the issue?
See here for details: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes#nested-jar-support
The connectivity issue with MongoDB "AWS DocumentDB" appears resolved after implementing the classic loader in Spring Boot 3.2.0:
bootJar {
archiveFileName = "${rootProject.name}.${archiveExtension.get()}"
loaderImplementation = LoaderImplementation.CLASSIC
}
I also noticed that the issue seems to occur only once during startup with version 3.2.0. Subsequent runs and reconnections to the database are smooth. with Uber JAR
Any additional insights or recommendations moving forward would be appreciated.
cc @philwebb