I am new to google cloud, I recently installed a mongodb cluster on google cloud instance. However I am unable to connect it from my application or Robomongo. Setting its configuration in the below manner in my spring mvc, I am using external ip as a host:
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
<constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
</bean>
Its giving below exception:
org.springframework.dao.DataAccessResourceFailureException: Timed out after 10000 ms while waiting for a server that matches AnyServerSelector{}.
Client view of cluster state is {type=Unknown, servers=[{address=104.196.32.97:27017, type=Unknown, state=Connecting}]; nested exception is com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting for a server that matches AnyServerSelector{}. Client view of cluster state is {type=Unknown, servers=[{address=104.196.32.97:27017, type=Unknown, state=Connecting}]
at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:73)
at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2011)
There is no tutorial available about integrating mongodb of gcloud with spring application.