描述错误 无法使用不同的连接字符串连接到Mongodb Atlas中的现有数据库失败,我也尝试了此处说明的解决方案
要复制
created docker-compose.yml
version: '3'
services:
prisma:
image: prismagraphql/prisma:1.34.1
restart: always
ports:
- "4466:4466"
environment:
PRISMA_CONFIG: |
port: 4466
# uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
# managementApiSecret: my-secret
databases:
default:
connector: mongo
uri: mongodb+srv://USERNAME:PASSWORD@cluster0-cr0y2.mongodb.net/DATABASE?retryWrites=true&w=majority
预期的行为 将pyramida服务器连接到mongodb
屏幕截图 在docker上的错误日志:
Exception in thread "main" com.mongodb.MongoConfigurationException: Unable to look up TXT record for host cluster0-cr0y2.mongodb.net
at com.mongodb.internal.dns.DnsResolver.resolveAdditionalQueryParametersFromTxtRecords(DnsResolver.java:123)
at com.mongodb.ConnectionString.<init>(ConnectionString.java:353)
at com.prisma.deploy.connector.mongo.MongoInternalDatabaseDefs.<init>(MongoInternalDatabaseDefs.scala:9)
at com.prisma.deploy.connector.mongo.MongoDeployConnector.internalDatabaseDefs$lzycompute(MongoDeployConnector.scala:14)
at com.prisma.deploy.connector.mongo.MongoDeployConnector.internalDatabaseDefs(MongoDeployConnector.scala:14)
at com.prisma.deploy.connector.mongo.MongoDeployConnector.mongoClient$lzycompute(MongoDeployConnector.scala:15)
at com.prisma.deploy.connector.mongo.MongoDeployConnector.mongoClient(MongoDeployConnector.scala:15)
at com.prisma.deploy.connector.mongo.MongoDeployConnector.internalDatabase$lzycompute(MongoDeployConnector.scala:16)
at com.prisma.deploy.connector.mongo.MongoDeployConnector.internalDatabase(MongoDeployConnector.scala:16)
at com.prisma.deploy.connector.mongo.MongoDeployConnector.<init>(MongoDeployConnector.scala:18)
at com.prisma.connectors.utils.ConnectorLoader$.loadDeployConnector(ConnectorLoader.scala:41)
at com.prisma.local.PrismaLocalDependencies.deployConnector$lzycompute(PrismaLocalDependencies.scala:83)
at com.prisma.local.PrismaLocalDependencies.deployConnector(PrismaLocalDependencies.scala:83)
at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:90)
at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
at scala.Function0.apply$mcV$sp(Function0.scala:34)
at scala.Function0.apply$mcV$sp$(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App.$anonfun$main$1$adapted(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:388)
at scala.App.main(App.scala:76)
at scala.App.main$(App.scala:74)
at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala)
Caused by: javax.naming.CommunicationException: DNS error [Root exception is java.net.SocketTimeoutException: Receive timed out]; remaining name 'cluster0-cr0y2.mongodb.net'
at com.sun.jndi.dns.DnsClient.query(DnsClient.java:312)
at com.sun.jndi.dns.Resolver.query(Resolver.java:81)
at com.sun.jndi.dns.DnsContext.c_getAttributes(DnsContext.java:434)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:235)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:141)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:129)
at javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:142)
at com.mongodb.internal.dns.DnsResolver.resolveAdditionalQueryParametersFromTxtRecords(DnsResolver.java:106)
... 24 more
Caused by: java.net.SocketTimeoutException: Receive timed out
at java.net.PlainDatagramSocketImpl.receive0(Native Method)
at java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:143)
at java.net.DatagramSocket.receive(DatagramSocket.java:812)
at com.sun.jndi.dns.DnsClient.doUdpQuery(DnsClient.java:422)
at com.sun.jndi.dns.DnsClient.query(DnsClient.java:211)
... 31 more
Exception in thread "main" com.mongodb.MongoConfigurationException: Unable to look up TXT record for host cluster0-cr0y2.mongodb.net
at com.mongodb.internal.dns.DnsResolver.resolveAdditionalQueryParametersFromTxtRecords(DnsResolver.java:123)
at com.mongodb.ConnectionString.<init>(ConnectionString.java:353)
at com.prisma.deploy.connector.mongo.MongoInternalDatabaseDefs.<init>(MongoInternalDatabaseDefs.scala:9)
at com.prisma.deploy.connector.mongo.MongoDeployConnector.internalDatabaseDefs$lzycompute(MongoDeployConnector.scala:14)
at com.prisma.deploy.connector.mongo.MongoDeployConnector.internalDatabaseDefs(MongoDeployConnector.scala:14)
at com.prisma.deploy.connector.mongo.MongoDeployConnector.mongoClient$lzycompute(MongoDeployConnector.scala:15)
at com.prisma.deploy.connector.mongo.MongoDeployConnector.mongoClient(MongoDeployConnector.scala:15)
at com.prisma.deploy.connector.mongo.MongoDeployConnector.internalDatabase$lzycompute(MongoDeployConnector.scala:16)
at com.prisma.deploy.connector.mongo.MongoDeployConnector.internalDatabase(MongoDeployConnector.scala:16)
at com.prisma.deploy.connector.mongo.MongoDeployConnector.<init>(MongoDeployConnector.scala:18)
at com.prisma.connectors.utils.ConnectorLoader$.loadDeployConnector(ConnectorLoader.scala:41)
at com.prisma.local.PrismaLocalDependencies.deployConnector$lzycompute(PrismaLocalDependencies.scala:83)
at com.prisma.local.PrismaLocalDependencies.deployConnector(PrismaLocalDependencies.scala:83)
at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:90)
at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
at scala.Function0.apply$mcV$sp(Function0.scala:34)
at scala.Function0.apply$mcV$sp$(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App.$anonfun$main$1$adapted(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:388)
at scala.App.main(App.scala:76)
at scala.App.main$(App.scala:74)
at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala)
Caused by: javax.naming.CommunicationException: DNS error [Root exception is java.net.SocketTimeoutException: Receive timed out]; remaining name 'cluster0-cr0y2.mongodb.net'
at com.sun.jndi.dns.DnsClient.query(DnsClient.java:312)
at com.sun.jndi.dns.Resolver.query(Resolver.java:81)
at com.sun.jndi.dns.DnsContext.c_getAttributes(DnsContext.java:434)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:235)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:141)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:129)
at javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:142)
at com.mongodb.internal.dns.DnsResolver.resolveAdditionalQueryParametersFromTxtRecords(DnsResolver.java:106)
... 24 more
Caused by: java.net.SocketTimeoutException: Receive timed out
at java.net.PlainDatagramSocketImpl.receive0(Native Method)
at java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:143)
at java.net.DatagramSocket.receive(DatagramSocket.java:812)
at com.sun.jndi.dns.DnsClient.doUdpQuery(DnsClient.java:422)
at com.sun.jndi.dns.DnsClient.query(DnsClient.java:211)
版本: