I'm working on a DB project and this class instantiation code below seems to be failing. I can't seem to figure out why. I've made sure to run mongod and start MongoDB. Does anyone have any tips on how to resolve this?
public DatabaseInterface() {
this.mongoClient = new MongoClient("127.0.0.1", 27017); ## This line
this.database = mongoClient.getDatabase("dbmsProjectDB");
this.gson = new Gson();
}
Exception in thread "main" java.lang.NoClassDefFoundError: com/mongodb/operation/ReadOperation
at backend.DatabaseInterface.<init>(DatabaseInterface.java:54)
at backend.main.main(main.java:8)
Caused by: java.lang.ClassNotFoundException: com.mongodb.operation.ReadOperation
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 2 more
MongoDbdriver are you using?