Reputation: 96391
Program is failing on line 1
MongoClient mongoClient = new MongoClient("localhost", 27017);
With
java.lang.NoSuchFieldError: ACKNOWLEDGED
at com.mongodb.MongoClientOptions$Builder.<init>(MongoClientOptions.java:54)
at com.mongodb.MongoClient.<init>(MongoClient.java:126)
at com.mongodb.MongoClient.<init>(MongoClient.java:115)
While mongo is,
Tue Nov 27 15:40:13 [initandlisten] waiting for connections on port 27017
What am i doing wrong please?
Upvotes: 2
Views: 8770
Reputation: 4042
I had the same problem and I realized that I have two java libraries for reading Mongo DB. When I removed one of them (com.mongodb-x-x.jar), the error disappeared.
Upvotes: 4
Reputation: 3813
I suspect that you have multiple versions of the mongo-java-driver jar in your classpath. Try running with -verbose:class to see where the WriteConcern class is being loaded from.
Upvotes: 6