如何将MongoDB Atlas连接到IntellijIdea

时间:2019-02-27 15:55:42

标签: mongodb intellij-idea connection cloud storage

我曾经在application.properties中使用此代码来连接Mongo-DB Atlas

spring.data.mongodb.host=
spring.data.mongodb.authentication-database=
spring.data.mongodb.username=
spring.data.mongodb.password=
spring.data.mongodb.database=
server.port=8081

但是运行代码时出现错误

com.mongodb.MongoSocketException: luster0-enytc.mongodb.net
    at com.mongodb.ServerAddress.getSocketAddress(ServerAddress.java:188) ~[mongodb-driver-core-3.8.2.jar:na]
    at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:64) ~[mongodb-driver-core-3.8.2.jar:na]
    at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:62) ~[mongodb-driver-core-3.8.2.jar:na]
    at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:126) ~[mongodb-driver-core-3.8.2.jar:na]
    at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117) ~[mongodb-driver-core-3.8.2.jar:na]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201]
Caused by: java.net.UnknownHostException: luster0-enytc.mongodb.net
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_201]
    at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929) ~[na:1.8.0_201]
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324) ~[na:1.8.0_201]
    at java.net.InetAddress.getAllByName0(InetAddress.java:1277) ~[na:1.8.0_201]
    at java.net.InetAddress.getAllByName(InetAddress.java:1193) ~[na:1.8.0_201]
    at java.net.InetAddress.getAllByName(InetAddress.java:1127) ~[na:1.8.0_201]
    at java.net.InetAddress.getByName(InetAddress.java:1077) ~[na:1.8.0_201]
    at com.mongodb.ServerAddress.getSocketAddress(ServerAddress.java:186) ~[mongodb-driver-core-3.8.2.jar:na]
    ... 5 common frames omitted

0 个答案:

没有答案