I have following problem:
1. I have setup spring boot app which uses MongoDB database.
2. I tested it locally and it works - app connects to database properly.
3. I deployed spring boot app to azure, but app cannot connect to MongoDB database. I get below exception:
"Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers= [{address=appexpirer.documents.azure.com:10250, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message}, caused by {java.net.SocketTimeoutException: Read timed out}}]; nested exception is com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers= [{address=appexpirer.documents.azure.com:10250, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message}, caused by {java.net.SocketTimeoutException: Read timed out}}]"
I believe that my application.properties are properly configured:
spring.data.mongodb.uri=mongodb://username:password@host:port/databaseName?ssl=true&sslInvalidHostNameAllowed=true
server.ssl.enabled=true
server.ssl.enabled-protocols=true
but I am not sure of that - could you please advice me what is wrong?
If I connect with using Robomongo tool everyting works well. I use Java 8 - can it be problem?