Как подключить MongoDB Atlas к IntellijIdea - PullRequest
0 голосов
/ 27 февраля 2019

Я использовал этот код в 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
...