-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 4.1.0
-
Component/s: Configuration
-
None
-
Environment:Mac os -> Catalina 10.150.6
Ubuntu os -> 20.04.1 LTS Focal
-
Needed
When I connect my Java Project using the below maven dependencies to Mongo 4.2.9 that was hosted remotely, If I'm using Macos, it will connects successfully.
<dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-mongodb</artifactId> <version>3.0.3.RELEASE</version> </dependency> <dependency> <groupId>org.mongodb</groupId> <artifactId>mongodb-driver-core</artifactId> <version>4.1.0</version> </dependency> <dependency> <groupId>org.mongodb</groupId> <artifactId>mongodb-driver-sync</artifactId> <version>4.0.1</version> </dependency>
When I was using Ubuntu, it will fail with the below exception:
java.lang.NoSuchMethodError: 'java.lang.String com.mongodb.connection.ClusterSettings.getDescription()'
But If I changed the dependencies to be like below:
<dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-mongodb</artifactId> <version>3.0.1.RELEASE</version> </dependency> <dependency> <groupId>org.mongodb</groupId> <artifactId>mongodb-driver-core</artifactId> <version>4.0.4</version> </dependency> <dependency> <groupId>org.mongodb</groupId> <artifactId>mongodb-driver-sync</artifactId> <version>4.0.4</version> </dependency>
It will fail to connect to Mongo 4.2.9 even on Mac or Ubuntu.
The error on Mac is:
nested exception is java.lang.NoSuchMethodError: 'java.lang.String com.mongodb.connection.ClusterSettings.getDescription()'
while the error on Ubuntu is:
nested exception is java.lang.NoSuchMethodError: 'void com.mongodb.internal.connection.DefaultClusterableServerFactory.<init>(..)