MongoDB Connection [solved]

0

Hi All:

I'm attempting to create a MongoDB DataAdapter in Jaspersoft Studio I get the following error:

net.sf.jasperreports.engine.JRException: Error creating MongoDBConnection; Caused by: Cannot test MongoDB connection; Caused by: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=1XX.XXX.XXX:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]
    at com.jaspersoft.mongodb.connection.MongoDbConnection.<init>(MongoDbConnection.java:87)
    at com.jaspersoft.mongodb.adapter.MongoDbDataAdapterService.createConnection(MongoDbDataAdapterService.java:70)
    at com.jaspersoft.mongodb.adapter.MongoDbDataAdapterService.test(MongoDbDataAdapterService.java:91)
    at com.jaspersoft.studio.data.DataAdapterEditorPart$1$1.runOperations(DataAdapterEditorPart.java:197)
    at com.jaspersoft.studio.utils.jobs.CheckedRunnableWithProgress$1.run(CheckedRunnableWithProgress.java:51)
    at java.lang.Thread.run(Thread.java:748)
Caused by: net.sf.jasperreports.engine.JRException: Cannot test MongoDB connection; Caused by: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=1XX.XXX.XXX:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]
    at com.jaspersoft.mongodb.connection.MongoDbConnection.test(MongoDbConnection.java:193)
    at com.jaspersoft.mongodb.connection.MongoDbConnection.<init>(MongoDbConnection.java:83)
    ... 5 more
Caused by: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=1XX.XXX.XXX:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]
    at com.mongodb.connection.BaseCluster.createTimeoutException(BaseCluster.java:369)
    at com.mongodb.connection.BaseCluster.selectServer(BaseCluster.java:101)
    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.getReadConnectionSource(ClusterBinding.java:63)
    at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:89)
    at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:84)
    at com.mongodb.operation.CommandReadOperation.execute(CommandReadOperation.java:55)
    at com.mongodb.Mongo.execute(Mongo.java:772)
    at com.mongodb.Mongo$2.execute(Mongo.java:759)
    at com.mongodb.DB.executeCommand(DB.java:653)
    at com.mongodb.DB.command(DB.java:423)
    at com.mongodb.DB.command(DB.java:439)
    at com.mongodb.DB.command(DB.java:381)
    at com.jaspersoft.mongodb.connection.MongoDbConnection.test(MongoDbConnection.java:188)
    ... 6 more

Any help would be appreciated.

dlee446's picture
Joined: Jan 24 2018 - 7:31am
Last seen: 1 year 8 months ago

I was able to determine that it was an issue with the bind parameter in the /etc/mongod.conf.  Instead of commenting it out I set it to 0.0.0.0 to all for remote access.

..
 
# network interfaces
net:
  port: 27017
  bindIp: 0.0.0.0
..

dlee446 - 1 year 8 months ago

0 Answers:

No answers yet
Feedback
randomness