gs-accessing-data-mongodb
gs-accessing-data-mongodb copied to clipboard
This package does not compile
I am getting the following error on running the complete package:
2017-06-11 12:54:12.973 INFO 25961 --- [ main] org.mongodb.driver.cluster : No server chosen by WritableServerSelector from cluster description ClusterDescription{type=UNKNOWN, connectionMode=SINGLE, serverDescriptions=[ServerDescription{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]}. Waiting for 30000 ms before timing out
I suspect it is related to this stackoverflow post: https://stackoverflow.com/questions/31933821/cant-connect-to-local-monogodb-from-java.
So essentially your code has a race condition between the mongodb database and the code (which is an error that is not always reproducible, as it depends on the speed and operating environment of the users computer). I have had the same issue with your other mongodb tutorial and so will be opening an issue there as well. It looks like to solve this it will require a refactor, but as I am new to java it is something that I cannot do on my own. Please fix!