Evyatar Elmaliah
Evyatar Elmaliah

Reputation: 624

java.lang.NoClassDefFoundError: com/mongodb/connection/BufferProvider

I'm trying to connect to mongoDB server from Java Servlet.
I added the following jars: bson-3.0.4.jar, mongodb-driver-3.0.4-javadoc.jar, mongodb-driver-core-3.0.4.jar and add this jars also to WEB-INF\lib directory.

And when i tried to run the following code:

MongoClient mongoClient = new MongoClient("localhost",27017);

I got the following exception:

java.lang.NoClassDefFoundError: com/mongodb/connection/BufferProvider

What i'm doing wrong?

Upvotes: 1

Views: 15218

Answers (2)

Fernando Aspiazu
Fernando Aspiazu

Reputation: 993

Couldn't it be better to use a dependency management like Maven or Gradle? I prefer to delegate someone else to resolve my dependencies...

Upvotes: 0

Deendayal Garg
Deendayal Garg

Reputation: 5148

Did you check out here, i think you need additional jar file.

http://mongodb.github.io/mongo-java-driver/3.0/driver/getting-started/installation-guide/#mongodb-driver

also checkout this link Having trouble connecting to MongoDB with Java

Upvotes: 6

Related Questions