# illegalArgumentException MongoDB river

**URL:** <https://discuss.elastic.co/t/illegalargumentexception-mongodb-river/14056>\
**Category:** Elasticsearch\
**Created:** [October 22, 2013, 2:26pm UTC](https://discuss.elastic.co/t/illegalargumentexception-mongodb-river/14056 "2013-10-22T14:26:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maarten\_Roosendaal](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@Maarten\_Roosendaal](https://discuss.elastic.co/u/Maarten_Roosendaal)\
**Post date:** [October 22, 2013, 2:26pm UTC](https://discuss.elastic.co/t/illegalargumentexception-mongodb-river/14056/1 "2013-10-22T14:26:24Z")

</div>

Hi,

I'm attempting to use the MongoDB river for elasticsearch but i get a:

[2013-10-22 16:10:44,911][WARN][river] [node1] failed  
to create river [mongodb][river-mongodb]  
java.lang.IllegalArgumentException  
at  
java.util.concurrent.ThreadPoolExecutor.(ThreadPoolExecutor.java:1310)  
at  
java.util.concurrent.ThreadPoolExecutor.(ThreadPoolExecutor.java:1198)  
at  
java.util.concurrent.Executors.newFixedThreadPool(Executors.java:89)  
at  
com.mongodb.DynamicConnectionStatus.start(DynamicConnectionStatus.java:44)  
at com.mongodb.DBTCPConnector.start(DBTCPConnector.java:52)  
at com.mongodb.Mongo.(Mongo.java:337)  
at com.mongodb.MongoClient.(MongoClient.java:253)  
at com.mongodb.MongoClient.(MongoClient.java:230)  
at  
org.elasticsearch.river.mongodb.MongoDBRiver.getMongoClient(MongoDBRiver.java:563)  
at  
org.elasticsearch.river.mongodb.MongoDBRiver.getAdminDb(MongoDBRiver.java:516)  
at  
org.elasticsearch.river.mongodb.MongoDBRiver.isMongos(MongoDBRiver.java:494)  
at  
org.elasticsearch.river.mongodb.MongoDBRiver.start(MongoDBRiver.java:461)  
at  
org.elasticsearch.river.RiversService.createRiver(RiversService.java:146)  
at  
org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:270)  
at  
org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:264)  
at  
org.elasticsearch.action.support.TransportAction$ThreadedActionListener$1.run(TransportAction.java:87)  
at  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
at java.lang.Thread.run(Thread.java:722)

My config:  
{  
"type": "mongodb",  
"mongodb": {  
"servers": {  
"host": "host",  
"port": "27017"  
},  
"db": "catalog",  
"collection": "products"  
},  
"index": {  
"name": "testmongo",  
"type": "product"  
}  
}

versions:  
ES: 90.1  
MongoDB-river: 1.6.8  
MongoDB: 2.4.3

Any suggestions?

Thanks,  
Maarten

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Hendrik](https://avatars.discourse-cdn.com/v4/letter/h/839c29/32.png) [@Hendrik](https://discuss.elastic.co/u/Hendrik)\
**Post date:** [October 23, 2013, 11:38am UTC](https://discuss.elastic.co/t/illegalargumentexception-mongodb-river/14056/2 "2013-10-23T11:38:12Z")

</div>

seems "servers" need to be an array (with bracktes):

"type": "mongodb",  
"mongodb": {  
"servers":  
[  
{ "host": "host1", "port": 27017 },  
{ "host": "host2", "port": 27017 }  
], ...

Am Dienstag, 22. Oktober 2013 16:26:24 UTC+2 schrieb Maarten Roosendaal:

> Hi,
> 
> I'm attempting to use the MongoDB river for elasticsearch but i get a:
> 
> [2013-10-22 16:10:44,911][WARN][river] [node1] failed  
> to create river [mongodb][river-mongodb]  
> java.lang.IllegalArgumentException  
> at  
> java.util.concurrent.ThreadPoolExecutor.(ThreadPoolExecutor.java:1310)  
> at  
> java.util.concurrent.ThreadPoolExecutor.(ThreadPoolExecutor.java:1198)  
> at  
> java.util.concurrent.Executors.newFixedThreadPool(Executors.java:89)  
> at  
> com.mongodb.DynamicConnectionStatus.start(DynamicConnectionStatus.java:44)  
> at com.mongodb.DBTCPConnector.start(DBTCPConnector.java:52)  
> at com.mongodb.Mongo.(Mongo.java:337)  
> at com.mongodb.MongoClient.(MongoClient.java:253)  
> at com.mongodb.MongoClient.(MongoClient.java:230)  
> at  
> org.elasticsearch.river.mongodb.MongoDBRiver.getMongoClient(MongoDBRiver.java:563)  
> at  
> org.elasticsearch.river.mongodb.MongoDBRiver.getAdminDb(MongoDBRiver.java:516)  
> at  
> org.elasticsearch.river.mongodb.MongoDBRiver.isMongos(MongoDBRiver.java:494)  
> at  
> org.elasticsearch.river.mongodb.MongoDBRiver.start(MongoDBRiver.java:461)  
> at  
> org.elasticsearch.river.RiversService.createRiver(RiversService.java:146)  
> at  
> org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:270)  
> at  
> org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:264)  
> at  
> org.elasticsearch.action.support.TransportAction$ThreadedActionListener$1.run(TransportAction.java:87)  
> at  
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
> at java.lang.Thread.run(Thread.java:722)
> 
> My config:  
> {  
> "type": "mongodb",  
> "mongodb": {  
> "servers": {  
> "host": "host",  
> "port": "27017"  
> },  
> "db": "catalog",  
> "collection": "products"  
> },  
> "index": {  
> "name": "testmongo",  
> "type": "product"  
> }  
> }
> 
> versions:  
> ES: 90.1  
> MongoDB-river: 1.6.8  
> MongoDB: 2.4.3
> 
> Any suggestions?
> 
> Thanks,  
> Maarten

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Maarten\_Roosendaal](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@Maarten\_Roosendaal](https://discuss.elastic.co/u/Maarten_Roosendaal)\
**Post date:** [October 24, 2013, 8:19am UTC](https://discuss.elastic.co/t/illegalargumentexception-mongodb-river/14056/3 "2013-10-24T08:19:21Z")

</div>

Thanks, that solved 1 problem, now i get a:  
com.mongodb.CommandFailureException: { "serverUsed" : "#####/ip:port" ,  
"code" : 18 , "ok" : 0.0 , "errmsg" : "auth fails"}

i assume the user is somehow not authorized to acces the database. Do you  
need to have both a local and an admin user?

```
[
  { "db": "local", "user": ${mongo.local.user}, "password": ${mongo.local.password} },
  { "db": "admin", "user": ${mongo.db.user}, "password": ${mongo.db.password} }
],

```

Op woensdag 23 oktober 2013 13:38:12 UTC+2 schreef Hendrik:

> seems "servers" need to be an array (with bracktes):
> 
> "type": "mongodb",  
> "mongodb": {  
> "servers":  
> [  
> { "host": "host1", "port": 27017 },  
> { "host": "host2", "port": 27017 }  
> ], ...
> 
> Am Dienstag, 22. Oktober 2013 16:26:24 UTC+2 schrieb Maarten Roosendaal:
> 
> > Hi,
> > 
> > I'm attempting to use the MongoDB river for elasticsearch but i get a:
> > 
> > [2013-10-22 16:10:44,911][WARN][river] [node1]  
> > failed to create river [mongodb][river-mongodb]  
> > java.lang.IllegalArgumentException  
> > at  
> > java.util.concurrent.ThreadPoolExecutor.(ThreadPoolExecutor.java:1310)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor.(ThreadPoolExecutor.java:1198)  
> > at  
> > java.util.concurrent.Executors.newFixedThreadPool(Executors.java:89)  
> > at  
> > com.mongodb.DynamicConnectionStatus.start(DynamicConnectionStatus.java:44)  
> > at com.mongodb.DBTCPConnector.start(DBTCPConnector.java:52)  
> > at com.mongodb.Mongo.(Mongo.java:337)  
> > at com.mongodb.MongoClient.(MongoClient.java:253)  
> > at com.mongodb.MongoClient.(MongoClient.java:230)  
> > at  
> > org.elasticsearch.river.mongodb.MongoDBRiver.getMongoClient(MongoDBRiver.java:563)  
> > at  
> > org.elasticsearch.river.mongodb.MongoDBRiver.getAdminDb(MongoDBRiver.java:516)  
> > at  
> > org.elasticsearch.river.mongodb.MongoDBRiver.isMongos(MongoDBRiver.java:494)  
> > at  
> > org.elasticsearch.river.mongodb.MongoDBRiver.start(MongoDBRiver.java:461)  
> > at  
> > org.elasticsearch.river.RiversService.createRiver(RiversService.java:146)  
> > at  
> > org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:270)  
> > at  
> > org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:264)  
> > at  
> > org.elasticsearch.action.support.TransportAction$ThreadedActionListener$1.run(TransportAction.java:87)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
> > at java.lang.Thread.run(Thread.java:722)
> > 
> > My config:  
> > {  
> > "type": "mongodb",  
> > "mongodb": {  
> > "servers": {  
> > "host": "host",  
> > "port": "27017"  
> > },  
> > "db": "catalog",  
> > "collection": "products"  
> > },  
> > "index": {  
> > "name": "testmongo",  
> > "type": "product"  
> > }  
> > }
> > 
> > versions:  
> > ES: 90.1  
> > MongoDB-river: 1.6.8  
> > MongoDB: 2.4.3
> > 
> > Any suggestions?
> > 
> > Thanks,  
> > Maarten

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Maarten\_Roosendaal](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@Maarten\_Roosendaal](https://discuss.elastic.co/u/Maarten_Roosendaal)\
**Post date:** [October 24, 2013, 9:35am UTC](https://discuss.elastic.co/t/illegalargumentexception-mongodb-river/14056/4 "2013-10-24T09:35:57Z")

</div>

i have a MongoDB user with which i can connect, through robomongo, to the  
mongodb cluster and to a collection aka content. However when i use this  
information for the mongodb-river i either get:

- com.mongodb.MongoException: not authorized for query on  
local.system.namespaces or
- com.mongodb.CommandFailureException: { "serverUsed" : "#####/ip:port" ,  
"code" : 18 , "ok" : 0.0 , "errmsg" : "auth fails"}  
depending on using 'local' or 'content' for the 'db' part op credentials

I've upgrade to ES 90.3, 1.7.0 plugin, we are using MongoDB version 2.4.5

Op donderdag 24 oktober 2013 10:19:21 UTC+2 schreef Maarten Roosendaal:

> Thanks, that solved 1 problem, now i get a:  
> com.mongodb.CommandFailureException: { "serverUsed" : "#####/ip:port" ,  
> "code" : 18 , "ok" : 0.0 , "errmsg" : "auth fails"}
> 
> i assume the user is somehow not authorized to acces the database. Do you  
> need to have both a local and an admin user?
> 
> ```
> [
> { "db": "local", "user": ${mongo.local.user}, "password": ${mongo.local.password} },
> { "db": "admin", "user": ${mongo.db.user}, "password": ${mongo.db.password} }
> ],
> 
> ```
> 
> Op woensdag 23 oktober 2013 13:38:12 UTC+2 schreef Hendrik:
> 
> > seems "servers" need to be an array (with bracktes):
> > 
> > "type": "mongodb",  
> > "mongodb": {  
> > "servers":  
> > [  
> > { "host": "host1", "port": 27017 },  
> > { "host": "host2", "port": 27017 }  
> > ], ...
> > 
> > Am Dienstag, 22. Oktober 2013 16:26:24 UTC+2 schrieb Maarten Roosendaal:
> > 
> > > Hi,
> > > 
> > > I'm attempting to use the MongoDB river for elasticsearch but i get a:
> > > 
> > > [2013-10-22 16:10:44,911][WARN][river] [node1]  
> > > failed to create river [mongodb][river-mongodb]  
> > > java.lang.IllegalArgumentException  
> > > at  
> > > java.util.concurrent.ThreadPoolExecutor.(ThreadPoolExecutor.java:1310)  
> > > at  
> > > java.util.concurrent.ThreadPoolExecutor.(ThreadPoolExecutor.java:1198)  
> > > at  
> > > java.util.concurrent.Executors.newFixedThreadPool(Executors.java:89)  
> > > at  
> > > com.mongodb.DynamicConnectionStatus.start(DynamicConnectionStatus.java:44)  
> > > at com.mongodb.DBTCPConnector.start(DBTCPConnector.java:52)  
> > > at com.mongodb.Mongo.(Mongo.java:337)  
> > > at com.mongodb.MongoClient.(MongoClient.java:253)  
> > > at com.mongodb.MongoClient.(MongoClient.java:230)  
> > > at  
> > > org.elasticsearch.river.mongodb.MongoDBRiver.getMongoClient(MongoDBRiver.java:563)  
> > > at  
> > > org.elasticsearch.river.mongodb.MongoDBRiver.getAdminDb(MongoDBRiver.java:516)  
> > > at  
> > > org.elasticsearch.river.mongodb.MongoDBRiver.isMongos(MongoDBRiver.java:494)  
> > > at  
> > > org.elasticsearch.river.mongodb.MongoDBRiver.start(MongoDBRiver.java:461)  
> > > at  
> > > org.elasticsearch.river.RiversService.createRiver(RiversService.java:146)  
> > > at  
> > > org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:270)  
> > > at  
> > > org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:264)  
> > > at  
> > > org.elasticsearch.action.support.TransportAction$ThreadedActionListener$1.run(TransportAction.java:87)  
> > > at  
> > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
> > > at  
> > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
> > > at java.lang.Thread.run(Thread.java:722)
> > > 
> > > My config:  
> > > {  
> > > "type": "mongodb",  
> > > "mongodb": {  
> > > "servers": {  
> > > "host": "host",  
> > > "port": "27017"  
> > > },  
> > > "db": "catalog",  
> > > "collection": "products"  
> > > },  
> > > "index": {  
> > > "name": "testmongo",  
> > > "type": "product"  
> > > }  
> > > }
> > > 
> > > versions:  
> > > ES: 90.1  
> > > MongoDB-river: 1.6.8  
> > > MongoDB: 2.4.3
> > > 
> > > Any suggestions?
> > > 
> > > Thanks,  
> > > Maarten

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dave\_padovano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dave_padovano/32/848_2.png) [@dave\_padovano](https://discuss.elastic.co/u/dave_padovano)\
**Post date:** [March 4, 2015, 8:04pm UTC](https://discuss.elastic.co/t/illegalargumentexception-mongodb-river/14056/5 "2015-03-04T20:04:25Z")

</div>

Id love to know if you found a solve for this. I am experiencing the same  
issue.

On Thursday, October 24, 2013 at 5:35:57 AM UTC-4, Maarten Roosendaal wrote:

> i have a MongoDB user with which i can connect, through robomongo, to the  
> mongodb cluster and to a collection aka content. However when i use this  
> information for the mongodb-river i either get:
> 
> - com.mongodb.MongoException: not authorized for query on  
> local.system.namespaces or
> - com.mongodb.CommandFailureException: { "serverUsed" : "#####/ip:port" ,  
> "code" : 18 , "ok" : 0.0 , "errmsg" : "auth fails"}  
> depending on using 'local' or 'content' for the 'db' part op credentials
> 
> I've upgrade to ES 90.3, 1.7.0 plugin, we are using MongoDB version 2.4.5
> 
> Op donderdag 24 oktober 2013 10:19:21 UTC+2 schreef Maarten Roosendaal:
> 
> > Thanks, that solved 1 problem, now i get a:  
> > com.mongodb.CommandFailureException: { "serverUsed" : "#####/ip:port" ,  
> > "code" : 18 , "ok" : 0.0 , "errmsg" : "auth fails"}
> > 
> > i assume the user is somehow not authorized to acces the database. Do you  
> > need to have both a local and an admin user?
> > 
> > ```
> > [
> > { "db": "local", "user": ${mongo.local.user}, "password": ${mongo.local.password} },
> > { "db": "admin", "user": ${mongo.db.user}, "password": ${mongo.db.password} }
> > ],
> > 
> > ```
> > 
> > Op woensdag 23 oktober 2013 13:38:12 UTC+2 schreef Hendrik:
> > 
> > > seems "servers" need to be an array (with bracktes):
> > > 
> > > "type": "mongodb",  
> > > "mongodb": {  
> > > "servers":  
> > > [  
> > > { "host": "host1", "port": 27017 },  
> > > { "host": "host2", "port": 27017 }  
> > > ], ...
> > > 
> > > Am Dienstag, 22. Oktober 2013 16:26:24 UTC+2 schrieb Maarten Roosendaal:
> > > 
> > > > Hi,
> > > > 
> > > > I'm attempting to use the MongoDB river for elasticsearch but i get a:
> > > > 
> > > > [2013-10-22 16:10:44,911][WARN][river] [node1]  
> > > > failed to create river [mongodb][river-mongodb]  
> > > > java.lang.IllegalArgumentException  
> > > > at  
> > > > java.util.concurrent.ThreadPoolExecutor.(ThreadPoolExecutor.java:1310)  
> > > > at  
> > > > java.util.concurrent.ThreadPoolExecutor.(ThreadPoolExecutor.java:1198)  
> > > > at  
> > > > java.util.concurrent.Executors.newFixedThreadPool(Executors.java:89)  
> > > > at  
> > > > com.mongodb.DynamicConnectionStatus.start(DynamicConnectionStatus.java:44)  
> > > > at com.mongodb.DBTCPConnector.start(DBTCPConnector.java:52)  
> > > > at com.mongodb.Mongo.(Mongo.java:337)  
> > > > at com.mongodb.MongoClient.(MongoClient.java:253)  
> > > > at com.mongodb.MongoClient.(MongoClient.java:230)  
> > > > at  
> > > > org.elasticsearch.river.mongodb.MongoDBRiver.getMongoClient(MongoDBRiver.java:563)  
> > > > at  
> > > > org.elasticsearch.river.mongodb.MongoDBRiver.getAdminDb(MongoDBRiver.java:516)  
> > > > at  
> > > > org.elasticsearch.river.mongodb.MongoDBRiver.isMongos(MongoDBRiver.java:494)  
> > > > at  
> > > > org.elasticsearch.river.mongodb.MongoDBRiver.start(MongoDBRiver.java:461)  
> > > > at  
> > > > org.elasticsearch.river.RiversService.createRiver(RiversService.java:146)  
> > > > at  
> > > > org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:270)  
> > > > at  
> > > > org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:264)  
> > > > at  
> > > > org.elasticsearch.action.support.TransportAction$ThreadedActionListener$1.run(TransportAction.java:87)  
> > > > at  
> > > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
> > > > at  
> > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
> > > > at java.lang.Thread.run(Thread.java:722)
> > > > 
> > > > My config:  
> > > > {  
> > > > "type": "mongodb",  
> > > > "mongodb": {  
> > > > "servers": {  
> > > > "host": "host",  
> > > > "port": "27017"  
> > > > },  
> > > > "db": "catalog",  
> > > > "collection": "products"  
> > > > },  
> > > > "index": {  
> > > > "name": "testmongo",  
> > > > "type": "product"  
> > > > }  
> > > > }
> > > > 
> > > > versions:  
> > > > ES: 90.1  
> > > > MongoDB-river: 1.6.8  
> > > > MongoDB: 2.4.3
> > > > 
> > > > Any suggestions?
> > > > 
> > > > Thanks,  
> > > > Maarten

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/de8af3f9-b4d0-4f6e-8a34-4cd880ff294f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/de8af3f9-b4d0-4f6e-8a34-4cd880ff294f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:28am UTC](https://discuss.elastic.co/t/illegalargumentexception-mongodb-river/14056/6 "2017-07-06T00:28:31Z")

</div>


