Google engine and mongodb

I use Java and MongoDB in the Google engine, but I cannot find links on how to connect to MongoDB with Java.

I tried 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 link on how to do this? Could not find anything on tzhe netz.

Thanks.

+1
source share
1 answer

You can not. You must use the provided storage options, such as data storage. Of course, you can connect via the web interface to an external instance, but I don’t think you are asking.

Take a look at the calculation of http://googlecloudplatform.blogspot.co.uk/2014/06/running-mongodb-on-google-compute-engine.html

+1
source

All Articles