[JAVA-3723] java.lang.NoSuchMethodError when using reactive stream driver Created: 05/May/20  Updated: 27/Oct/23  Resolved: 05/May/20

Status: Closed
Project: Java Driver
Component/s: API, Change Streams
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Manoj Kumar Julakanti Assignee: Jeffrey Yemin
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu , Java 1.8 , Maven


Attachments: XML File pom.xml    

 Description   

I'm trying to initialize the client with this code:

 

Exception in thread "main" java.lang.NoSuchMethodError: com.mongodb.MongoClientSettings.getAutoEncryptionSettings()Lcom/mongodb/AutoEncryptionSettings;Exception in thread "main" java.lang.NoSuchMethodError: com.mongodb.MongoClientSettings.getAutoEncryptionSettings()Lcom/mongodb/AutoEncryptionSettings; at com.mongodb.async.client.MongoClientSettings.getAutoEncryptionSettings(MongoClientSettings.java:731) at com.mongodb.async.client.MongoClientImpl.<init>(MongoClientImpl.java:70) at com.mongodb.async.client.MongoClientImpl.<init>(MongoClientImpl.java:57) at com.mongodb.async.client.MongoClients.createMongoClient(MongoClients.java:191) at com.mongodb.async.client.MongoClients.createWithAsynchronousSocketChannel(MongoClients.java:265) at com.mongodb.async.client.MongoClients.create(MongoClients.java:177) at com.mongodb.async.client.MongoClients.create(MongoClients.java:136) at com.mongodb.reactivestreams.client.MongoClients.create(MongoClients.java:86) at com.mongodb.reactivestreams.client.MongoClients.create(MongoClients.java:72) at com.phenom.search.changestreams.ChangeStreamSamples.main(ChangeStreamSamples.java:36)

 

 

 

 



 Comments   
Comment by Manoj Kumar Julakanti [ 05/May/20 ]

Solved , Thanks for you time

Comment by Jeffrey Yemin [ 05/May/20 ]

You can use an older version of reactive streams.

Comment by Manoj Kumar Julakanti [ 05/May/20 ]

No, I need them in other classes in the project , any alternative

Comment by Jeffrey Yemin [ 05/May/20 ]

Try removing

        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-sync</artifactId>
            <version>3.8.2</version>
        </dependency>
 
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongo-java-driver</artifactId>
            <version>3.8.2</version>

They are not new enough to work with mongodb-driver-reactivestreams 1.12 release. Removing them will let Maven pick up the right driver version via transitive dependencies.

Generated at Thu Feb 08 09:00:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.