Teiid 12.2 dockerized unable to connect to mongodb instance on Atlas
m.ardito Oct 6, 2019 11:55 AMHi,
I'm back on Teiid since a long time, and now trying to deploy a wildfly server on docker with teiid 12.2 and the latest web console.
Everything works quite smoothly:
- I can configure a mongodb RA connection definition
- although I struggled a bit with the RemoteServerList which, I learned reading sources, MUST begin with a "mongodb://" string, it seems or it will not be able to load correctly
see MongoDBManagedConnectionFactory.java
- although I struggled a bit with the RemoteServerList which, I learned reading sources, MUST begin with a "mongodb://" string, it seems or it will not be able to load correctly
- I can deploy a mongodb test VDB (xml) which is valid and active
My mongodb source is a "free tier" Atlas instance, which gives me this connection string (replaced sensitive info with XXXX)
mongodb+srv://:@cluster0-XXXXX.mongodb.net/admin?retryWrites=true&w=majority
which works everywhere (replacing user and password of course) in clients like MongoDB Compass
my RA connection definition is declared as: (replaced sensitive info with XXXX)
/subsystem=resource-adapters/resource-adapter=mongodb/connection-definitions=mongodbDS:add(jndi-name=java:/mongodbDS, class-name=org.teiid.resource.adapter.mongodb.MongoDBManagedConnectionFactory, enabled=true, use-java-context=true) /subsystem=resource-adapters/resource-adapter=mongodb/connection-definitions=mongodbDS/config-properties=RemoteServerList:add(value="mongodb://cluster0-XXXXX.mongodb.net") /subsystem=resource-adapters/resource-adapter=mongodb/connection-definitions=mongodbDS/config-properties=Database:add(value="XXXXX") /subsystem=resource-adapters/resource-adapter=mongodb/connection-definitions=mongodbDS/config-properties=Username:add(value="XXXXX") /subsystem=resource-adapters/resource-adapter=mongodb/connection-definitions=mongodbDS/config-properties=Password:add(value="XXXXX") /subsystem=resource-adapters/resource-adapter=mongodb/connection-definitions=mongodbDS/config-properties=Ssl:add(value="true") /subsystem=resource-adapters/resource-adapter=mongodb:activate
But as soon as I try a query, either from the console's https://developer.jboss.org/ or a SquirrelSQL connection (from my pc, the docker hosting the teiid container)
- I get no results, or hanging query in SquirrelSQL
- in the logs I see something like (replaced sensitive info with XXXX)
11:12:18,171 INFO [org.mongodb.driver.cluster] (cluster-ClusterId{value='XXXXXXXXXXXXXXXXXX', description='null'}-cluster0-XXXXX.mongodb.net:27017) uqfyXAth7Iu5 Exception in monitor thread while connecting to server cluster0-XXXXX.mongodb.net:27017: com.mongodb.MongoSocketException: cluster0-XXXXX.mongodb.net: Name or service not known at com.mongodb//com.mongodb.ServerAddress.getSocketAddresses(ServerAddress.java:211) at com.mongodb//com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:75) at com.mongodb//com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65) at com.mongodb//com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:126) at com.mongodb//com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.net.UnknownHostException: cluster0-XXXXX.mongodb.net: Name or service not known at java.base/java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:929) at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1515) at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848) at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1505) at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1364) at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1298) at com.mongodb//com.mongodb.ServerAddress.getSocketAddresses(ServerAddress.java:203) ... 5 more
and I don't understand why I get a
Exception in monitor thread while connecting to server cluster0-XXXXX.mongodb.net:27017: com.mongodb.MongoSocketException: cluster0-ef08y.mongodb.net: Name or service not known
could anyone help me to fix this?