Jul 28, 2015 12:11:02 PM io.vertx.core.Starter
INFORMATION: Succeeded in deploying verticle
Jul 28, 2015 12:11:03 PM com.mongodb.diagnostics.logging.JULLogger log
INFORMATION: Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
Jul 28, 2015 12:11:03 PM com.mongodb.diagnostics.logging.JULLogger log
INFORMATION: Exception in monitor thread while connecting to server localhost:27017
com.mongodb.MongoInternalException: Opening the AsynchronousSocketChannelStream failed
at com.mongodb.connection.FutureAsyncCompletionHandler.get(FutureAsyncCompletionHandler.java:65)
at com.mongodb.connection.FutureAsyncCompletionHandler.getOpen(FutureAsyncCompletionHandler.java:43)
at com.mongodb.connection.AsynchronousSocketChannelStream.open(AsynchronousSocketChannelStream.java:60)
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:114)
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:127)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.connection.AsynchronousSocketChannelStream$1.failed(AsynchronousSocketChannelStream.java:86)
at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:128)
at sun.nio.ch.Invoker$2.run(Invoker.java:218)
at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
... 1 more
Caused by: java.net.ConnectException: Connection refused
at sun.nio.ch.UnixAsynchronousSocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishConnect(UnixAsynchronousSocketChannelImpl.java:252)
at sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:198)
at sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:213)
at sun.nio.ch.KQueuePort$EventHandlerTask.run(KQueuePort.java:301)
... 1 more
I found this documentation http://vertx.io/docs/vertx-mongo-client/java/ and examples: https://github.com/halber/TestVertx3MongoDB/blob/master/src/main/java/App.java
http://github.com/vert-x3/vertx-examples/blob/master/web-examples/src/main/java/io/vertx/example/web/mongo/Server.java and I implemented the logging.
When I try to store data into the db I get this:
INFORMATION: No server chosen by PrimaryServerSelector from cluster description ClusterDescription{type=UNKNOWN, connectionMode=SINGLE, all=[ServerDescription{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoInternalException: Opening the AsynchronousSocketChannelStream failed}, caused by {com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused}}]}. Waiting for 30000 ms before timing out
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/de274c6b-4076-42c4-9c86-4afd26713e40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
public static final String ADDRESS = "mongodb-persistor";
public static final String DEFAULT_MONGODB_CONFIG
= "{"
+ " \"address\": \"" + ADDRESS + "\","
+ " \"host\": \"localhost\","
+ " \"port\": 27017,"
+ " \"db_name\": \"bs\","
+ " \"useObjectId\" : true"
+ "}";
MongoClient mongo;
@Override
public void start() {
mongo = MongoClient.createShared(vertx, new JsonObject(DEFAULT_MONGODB_CONFIG));
LOGGER.info("MongoClient is started with this config: " + new JsonObject(DEFAULT_MONGODB_CONFIG).encodePrettily());