exception - mongodb casbah, check connection -


i'm using akka-http , casbah interacting mongodb. can't catch exception thrown com.mongodb.connection.socketstreamhelper , therefore can't complete request , hangs long time... don't understand why it's not possible catch, may exception thrown in thread, or smth else.. sorry, don't know code apply question

stacktrace printed though:

[info] starting application server in background ... server starting adstorage.akka.main.main() server listening transport dt_socket @ address: 5005 [success] total time: 1 s, completed apr 6, 2017 12:54:15 pm > server[error] slf4j: failed load class "org.slf4j.impl.staticloggerbinder". server[error] slf4j: defaulting no-operation (nop) logger implementation server[error] slf4j: see http://www.slf4j.org/codes.html#staticloggerbinder further details. server server started 8080... server[error] apr 06, 2017 12:54:34 pm com.mongodb.diagnostics.logging.jullogger log server[error] info: cluster created settings {hosts=[localhost:27017], mode=single, requiredclustertype=unknown, serverselectiontimeout='30000 ms', maxwaitqueuesize=500} server[error] apr 06, 2017 12:54:34 pm com.mongodb.diagnostics.logging.jullogger log server[error] info: exception in monitor thread while connecting server localhost:27017 server[error] com.mongodb.mongosocketopenexception: exception opening socket server[error]   @ com.mongodb.connection.socketstream.open(socketstream.java:63) server[error]   @ com.mongodb.connection.internalstreamconnection.open(internalstreamconnection.java:114) server[error]   @ com.mongodb.connection.defaultservermonitor$servermonitorrunnable.run(defaultservermonitor.java:128) server[error]   @ java.lang.thread.run(thread.java:745) server[error] caused by: java.net.connectexception: connection refused (connection refused) server[error]   @ java.net.plainsocketimpl.socketconnect(native method) server[error]   @ java.net.abstractplainsocketimpl.doconnect(abstractplainsocketimpl.java:350) server[error]   @ java.net.abstractplainsocketimpl.connecttoaddress(abstractplainsocketimpl.java:206) server[error]   @ java.net.abstractplainsocketimpl.connect(abstractplainsocketimpl.java:188) server[error]   @ java.net.sockssocketimpl.connect(sockssocketimpl.java:392) server[error]   @ java.net.socket.connect(socket.java:589) server[error]   @ com.mongodb.connection.socketstreamhelper.initialize(socketstreamhelper.java:50) server[error]   @ com.mongodb.connection.socketstream.open(socketstream.java:58) server[error]   ... 3 more server[error]  server[error] apr 06, 2017 12:55:50 pm com.mongodb.diagnostics.logging.jullogger log server[error] info: no server chosen readpreferenceserverselector{readpreference=primary} cluster description clusterdescription{type=unknown, connectionmode=single, all=[serverdescription{address=localhost:27017, type=unknown, state=connecting, exception={com.mongodb.mongosocketopenexception: exception opening socket}, caused {java.net.connectexception: connection refused (connection refused)}}]}. waiting 30000 ms before timing out 

[added]

i try mongo-scala-driver.

val client = mongoclient("mongodb://localhost:27017")     client.getdatabase("profile_5").getcollection("campaigns").find[document](document.parse(json.obj(       "name" -> "asd"     ).tostring())).subscribe(new observer[document] {       def onerror(e: throwable): unit = println(s"onerror: ${e.getmessage}")       def oncomplete(): unit = println("oncomplete")       def onnext(result: document): unit = println(s"onnext: $result")     }) 

result is:

> mongo 13:09:02.573 [main] info org.mongodb.driver.cluster - cluster created settings {hosts=[localhost:27017], mode=single, requiredclustertype=unknown, serverselectiontimeout='30000 ms', maxwaitqueuesize=500} mongo 13:09:02.675 [main] debug org.mongodb.driver.cluster - updating cluster description  {type=unknown, servers=[{address=localhost:27017, type=unknown, state=connecting}] mongo 13:09:02.770 [cluster-clusterid{value='58e7653e7285c53714b770e5', description='null'}-localhost:27017] debug org.mongodb.driver.connection - closing connection connectionid{localvalue:1} mongo 13:09:02.778 [cluster-clusterid{value='58e7653e7285c53714b770e5', description='null'}-localhost:27017] info org.mongodb.driver.cluster - exception in monitor thread while connecting server localhost:27017 mongo com.mongodb.mongosocketopenexception: exception opening socket mongo   @ com.mongodb.connection.asynchronoussocketchannelstream$opencompletionhandler.failed(asynchronoussocketchannelstream.java:253) mongo   @ sun.nio.ch.invoker.invokeunchecked(invoker.java:128) mongo   @ sun.nio.ch.invoker$2.run(invoker.java:218) mongo   @ sun.nio.ch.asynchronouschannelgroupimpl$1.run(asynchronouschannelgroupimpl.java:112) mongo   @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) mongo   @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) mongo   @ java.lang.thread.run(thread.java:745) mongo caused by: java.net.connectexception: connection refused mongo   @ sun.nio.ch.unixasynchronoussocketchannelimpl.checkconnect(native method) mongo   @ sun.nio.ch.unixasynchronoussocketchannelimpl.finishconnect(unixasynchronoussocketchannelimpl.java:252) mongo   @ sun.nio.ch.unixasynchronoussocketchannelimpl.finish(unixasynchronoussocketchannelimpl.java:198) mongo   @ sun.nio.ch.unixasynchronoussocketchannelimpl.onevent(unixasynchronoussocketchannelimpl.java:213) mongo   @ sun.nio.ch.epollport$eventhandlertask.run(epollport.java:293) mongo   ... 1 common frames omitted mongo 13:09:02.780 [cluster-clusterid{value='58e7653e7285c53714b770e5', description='null'}-localhost:27017] debug org.mongodb.driver.cluster - updating cluster description  {type=unknown, servers=[{address=localhost:27017, type=unknown, state=connecting, exception={com.mongodb.mongosocketopenexception: exception opening socket}, caused {java.net.connectexception: connection refused}}] mongo 13:09:02.973 [main] info org.mongodb.driver.cluster - no server chosen readpreferenceserverselector{readpreference=primary} cluster description clusterdescription{type=unknown, connectionmode=single, serverdescriptions=[serverdescription{address=localhost:27017, type=unknown, state=connecting, exception={com.mongodb.mongosocketopenexception: exception opening socket}, caused {java.net.connectexception: connection refused}}]}. waiting 30000 ms before timing out mongo ... finished exit code 0 

i expected see onerror there's nothing...


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -