2

I'd like to connect to my MongoDB (hosted on MongoHQ). I get the following error when I want connect to the database (with the Java driver)

ERROR/AndroidRuntime(597): java.lang.NoClassDefFoundError: com.mongodb.DBPortPool
ERROR/AndroidRuntime(597):     at com.mongodb.DBPortPool$Holder.get(DBPortPool.java:52)
ERROR/AndroidRuntime(597):     at com.mongodb.DBTCPConnector._set(DBTCPConnector.java:380)
ERROR/AndroidRuntime(597):     at com.mongodb.DBTCPConnector.<init>(DBTCPConnector.java:46)
ERROR/AndroidRuntime(597):     at com.mongodb.Mongo.<init>(Mongo.java:138)
ERROR/AndroidRuntime(597):     at com.mongodb.Mongo.<init>(Mongo.java:124)
ERROR/AndroidRuntime(597):     at com.mongodb.Mongo.<init>(Mongo.java:114)
ERROR/AndroidRuntime(597):     at xxx.MainActivity$1.onClick(MainActivity.java:29)

I use the following code:

Mongo mng = new Mongo("flame.mongohq.com", 27073); // <- error
DB mngDb = mng.getDB("xxx");
mngDb.authenticate("xxx", "xxx".toCharArray());
DBCollection mngColl = mngDb.getCollection("xxx");
// mText.setText("Data Count: "+Long.toString(mngColl.getCount()));

I added the driver in Eclipse via Properties>Java Build Path>Libraries>Add Externel JAR

2 Answers 2

1

This driver does not support android...

Sign up to request clarification or add additional context in comments.

1 Comment

This issue has now been fixed. (link) ;]
1

The DBPortPool has a dependancy on JMX however JMX is not supported on android.

Out of interest, what is your use case? As you will want to avoid passing database username/pwd from your phone without security infrastructure.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.