I'm using Java and MongoDB on google app engine but I cant find any reference on how to connect to MongoDB with Java.
I've tried with the following:
Maven:
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.6.3</version>
</dependency>
Java:
String serverName = ""; //provided external and internal ip addresses as well as name of mongoDB instance,
Mongo mongo = new Mongo(serverName); //com.addsapp.dao.MongoDB.initDB1(MongoDB.java:39)
And got the following result:
Uncaught exception from servlet
java.lang.ExceptionInInitializerError
at com.mongodb.Bytes.<clinit>(Bytes.java:215)
at com.mongodb.MongoOptions.reset(MongoOptions.java:32)
at com.mongodb.MongoOptions.<init>(MongoOptions.java:28)
at com.mongodb.Mongo.<init>(Mongo.java:175)
at com.mongodb.Mongo.<init>(Mongo.java:140)
at com.addsapp.dao.MongoDB.initDB1(MongoDB.java:39)
...
Does anyone have a good Java reference on how to do this? Couldn't find anything on tzhe netz.
Thanks.