我在牧场主中添加了mongodb replicasets作为堆栈。
我已将服务的链接配置为mongodb。但是每当我在spring boot应用程序中连接到数据库时,我都会遇到这个异常:
7/5/2016 6:57:24 AMcom.mongodb.MongoException: not talking to master and retries used up
7/5/2016 6:57:24 AM at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:323) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:325) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:325) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:273) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:86) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:68) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBCursor._check(DBCursor.java:498) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBCursor._hasNext(DBCursor.java:621) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBCursor.hasNext(DBCursor.java:657) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1943) ~[spring-data-mongodb-1.9.1.RELEASE.jar!/:na]
我是否需要在Spring启动应用程序中添加任何其他配置才能使其正常工作。 非常感谢你。
答案 0 :(得分:0)
进行这些更改,然后它将起作用。