I’m trying to get my tests working on the 14.04 image, but I’m having difficulty with the MongoDB connection.
I have some rather unexciting code to connect to the database:
final Datastore datastore = morphia.createDatastore(new MongoClient("127.0.0.1"), "applicationname");
And an equally unexciting Circle.yml file:
machine:
java:
version: openjdk8
test:
pre:
- sudo service mongod status || sudo service mongod start
override:
- mvn clean test
It works fine until the tests actually start (i.e the service starts successfully), but when it tries to connect it throws:
java.lang.RuntimeException: java.net.SocketException: Permission denied
Caused by: java.net.SocketException: Permission denied
The same problem happens when relying on the default instance of MongoDB.
Maybe I am missing something, but I would have thought that MongoDB would be running on the default port on localhost…
Where should my connection be pointing?