Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

MongoDB Atlas Connection Issue

I have been looking around and cannot find a problem similar to mine. I am having an issue with MongoDB, in this case MongoDB Atlas, connecting to server. I am using a replica set and when I check my connection I eventually get a connection time out. Here is a snippet of some of the error message, I can post all of it if it would be more helpful. I have reconfirmed the username and password multiple times as well as the host/ports. This had happened to me before with another ETL tool and required some sort of patch. Any suggestions welcome.

 

Connection failed!
  org.talend.repository.nosql.exceptions.NoSQLServerException: Cannot connect to database!
      at org.talend.repository.nosql.db.util.mongodb.MongoDBConnectionUtil.checkConnection(MongoDBConnectionUtil.java:72)
      at org.talend.repository.nosql.db.provider.mongodb.MongoDBMetadataProvider.checkConnection(MongoDBMetadataProvider.java:153)
      at org.talend.repository.nosql.ui.common.AbstractNoSQLConnForm$1.widgetSelected(AbstractNoSQLConnForm.java:141)
      at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
      at org.eclipse.jface.window.Window.runEventLoop(Window.java:832)
      at org.eclipse.jface.window.Window.open(Window.java:808)
      at org.talend.repository.nosql.action.CreateNoSQLConnectionAction.doRun(CreateNoSQLConnectionAction.java:91)
      at org.talend.repository.ui.actions.AContextualAction$2.run(AContextualAction.java:630)
      at org.talend.repository.RepositoryWorkUnit.executeRun(RepositoryWorkUnit.java:99)
      at org.talend.core.repository.model.AbstractRepositoryFactory.executeRepositoryWorkUnit(AbstractRepositoryFactory.java:258)
      at org.talend.repository.localprovider.model.LocalRepositoryFactory.executeRepositoryWorkUnit(LocalRepositoryFactory.java:3420)
      at org.talend.core.repository.model.ProxyRepositoryFactory.executeRepositoryWorkUnit(ProxyRepositoryFactory.java:2247)
      at org.talend.repository.ui.actions.AContextualAction.run(AContextualAction.java:639)
      at org.talend.repository.viewer.action.RepoDoubleClickAction.run(RepoDoubleClickAction.java:119)
      at org.eclipse.ui.actions.RetargetAction.run(RetargetAction.java:229)
      at org.eclipse.ui.navigator.CommonNavigatorManager$3.open(CommonNavigatorManager.java:185)
      at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
      at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:853)
      at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
      at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:178)
      at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:850)
      at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1142)
      at org.eclipse.ui.navigator.CommonViewer.handleOpen(CommonViewer.java:462)
      at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1249)
      at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:278)
      at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:272)
      at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:313)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
      at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
      at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
      at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
      at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
      at org.talend.rcp.intro.Application.start(Application.java:265)
      at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
      at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
      at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
  Caused by: org.talend.repository.nosql.exceptions.NoSQLReflectionException: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches WritableServerSelector. Client view of cluster state is {type=UNKNOWN, servers=[{address=wwnortonweb-stg-shard-00-00-0ykgb.mongodb.net:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}, {address=wwnortonweb-stg-shard-00-01-0ykgb.mongodb.net:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}, {address=wwnortonweb-stg-shard-00-02-0ykgb.mongodb.net:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}]
      at org.talend.repository.nosql.reflection.NoSQLReflection$WrapException.wrap(NoSQLReflection.java:97)
      at org.talend.repository.nosql.reflection.NoSQLReflection.invokeMethod(NoSQLReflection.java:68)
      at org.talend.repository.nosql.reflection.NoSQLReflection.invokeMethod(NoSQLReflection.java:53)
      at org.talend.repository.nosql.db.util.mongodb.MongoDBConnectionUtil.checkConnection(MongoDBConnectionUtil.java:69)
      ... 58 more
  Caused by: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches WritableServerSelector. Client view of cluster state is {type=UNKNOWN, servers=[{address=wwnortonweb-stg-shard-00-00-0ykgb.mongodb.net:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}, {address=wwnortonweb-stg-shard-00-01-0ykgb.mongodb.net:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}, {address=wwnortonweb-stg-shard-00-02-0ykgb.mongodb.net:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}]
      at com.mongodb.connection.BaseCluster.createTimeoutException(BaseCluster.java:375)
      at com.mongodb.connection.BaseCluster.selectServer(BaseCluster.java:104)
      at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.<init>(ClusterBinding.java:75)
      at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.<init>(ClusterBinding.java:71)
      at com.mongodb.binding.ClusterBinding.getWriteConnectionSource(ClusterBinding.java:68)
      at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:159)
      at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:134)
      at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:124)
      at com.mongodb.operation.CommandWriteOperation.execute(CommandWriteOperation.java:55)
      at com.mongodb.Mongo.execute(Mongo.java:819)
      at com.mongodb.Mongo$2.execute(Mongo.java:802)
      at com.mongodb.DB.executeCommand(DB.java:724)
      at com.mongodb.DB.getStats(DB.java:593)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.talend.core.utils.ReflectionUtils.invokeMethod(ReflectionUtils.java:166)
      at org.talend.repository.nosql.reflection.NoSQLReflection$3.toDo(NoSQLReflection.java:63)
      at org.talend.repository.nosql.reflection.NoSQLReflection$WrapException.wrap(NoSQLReflection.java:95)
      ... 61 more
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I appreciate all the help. I actually was able to fix my specific issue. It turns out that the cluster name is case sensitive with the Java driver for MongoDB. Once I fixed the case to match I was able to connect. Here is a link to the relevant Jira ticket with MongoDB.

 

https://jira.mongodb.org/browse/JAVA-2569

 

Thanks again!

View solution in original post

6 Replies
Anonymous
Not applicable
Author

Hello,

You may be need to configure an IP_whitelist in MongoBD Atlas, and set the IP from where you run the job.

Have you tried it ?

Anonymous
Not applicable
Author

I will double check but I do want to note that I am able to connect to this Mongo server using other tools from this machine without issue (Robo 3T, SSIS). This would lead me to believe that its not a whitelisting issue, correct me if I am wrong.

Anonymous
Not applicable
Author

I was able to confirm that IP does not need to be white-listed for the cluster I am trying to connect to, still cannot connect.

Anonymous
Not applicable
Author

I use a MongoDB Atlas that I did not configure, however I have checked "Set Authentification database". Then a new field appears, I personnaly fill it by "admin" (depending on version: quotation marks are not always necessary in this field (and if it is not, I recommand you to not put them, it can create a deployment error for Cloud version)).

I hope it will help you

 
Anonymous
Not applicable
Author

I appreciate all the help. I actually was able to fix my specific issue. It turns out that the cluster name is case sensitive with the Java driver for MongoDB. Once I fixed the case to match I was able to connect. Here is a link to the relevant Jira ticket with MongoDB.

 

https://jira.mongodb.org/browse/JAVA-2569

 

Thanks again!

Anonymous
Not applicable
Author