为什么我最终得到Casbah / Java MongoDB驱动程序的java.lang.IllegalArgumentException? [英] Why do I end up with java.lang.IllegalArgumentException for Casbah / Java MongoDB Driver?

查看:158
本文介绍了为什么我最终得到Casbah / Java MongoDB驱动程序的java.lang.IllegalArgumentException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 casbah / java驱动程序时遇到一个奇怪的问题。



我一直遇到当驱动程序尝试从mongo创建响应时出现以下异常:

  
2012年10月16日10:45:07 AM com.mongodb.DBTCPConnector $ MyPort error
SEVERE:MyPort.error名为
java.lang.IllegalArgumentException:响应太长:1634610484
at com.mongodb.Response。(Response.java: 40)
at com.mongodb.DBPort.go(DBPort.java:110)
at com.mongodb.DBPort.go(DBPort.java:75)
at com.mongodb.DBPort .call(DBPort.java:65)
at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:201)
at com.mongodb.DBApiLayer $ MyCollection .__ find(DBApiLayer.java:295)
at com.mongodb.DBCursor._check(DBCursor.java:354)
at com.mongodb.DBCursor._hasNext(DBCursor.java:484)
at com.mongodb.DBCursor.hasNext( DBCursor.java:509)
at com.mongodb.casbah.MongoCursorBase $ class.hasNext(MongoC ursor.scala:73)
at com.mongodb.casbah.MongoCursor.hasNext(MongoCursor.scala:497)
at scala.collection.Iterator $ class.foreach(Iterator.scala:660)
at com.mongodb.casbah.MongoCursor.foreach(MongoCursor.scala:497)
...

这似乎是随机发生的,即使在mongo不应该从查询中返回任何结果的情况下也是如此。报告的大小不一致,通常大于它应该或可能的大小。



我猜这可能是某种形式的腐败与响应。我使用Wireshark很难解决这个问题,但我一直发现导致响应抛出此错误的查询的请求/响应链有来自MongoDB的TCP Window Full响应:





我正在使用的版本:



  
Casbah:2.1。 5.0
Mongo Java驱动程序:2.5.3
MongoDB:2.2



<如果有人能对我可能做错的事情提出任何建议,或者有关如何进一步调试此问题的指示,我将不胜感激



更新:在查看 Casbah 2.1.5.0,的发行说明后,看来正在使用的java驱动程序的版本是2.5.3,而不是2.7。 3

解决方案

您使用的Java驱动程序版本与Mong不兼容oDB 2.2。你应该使用至少2.9.3,如果不是2.10或更高。我们无法保证驱动程序升级可以解决您的问题,但这应该是第一步。



https://support.mongolab.com/entries/22631012-which-drivers-support-mongodb-2-2


I'm seeing a strange issue using the casbah / java driver.

I keep running into the following exception when the driver tries to create a response from mongo:


  Oct 16, 2012 10:45:07 AM com.mongodb.DBTCPConnector$MyPort error
  SEVERE: MyPort.error called
  java.lang.IllegalArgumentException: response too long: 1634610484
    at com.mongodb.Response.(Response.java:40)
    at com.mongodb.DBPort.go(DBPort.java:110)
    at com.mongodb.DBPort.go(DBPort.java:75)
    at com.mongodb.DBPort.call(DBPort.java:65)
    at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:201)
    at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:295)
    at com.mongodb.DBCursor._check(DBCursor.java:354)
    at com.mongodb.DBCursor._hasNext(DBCursor.java:484)
    at com.mongodb.DBCursor.hasNext(DBCursor.java:509)
    at com.mongodb.casbah.MongoCursorBase$class.hasNext(MongoCursor.scala:73)
    at com.mongodb.casbah.MongoCursor.hasNext(MongoCursor.scala:497)
    at scala.collection.Iterator$class.foreach(Iterator.scala:660)
    at com.mongodb.casbah.MongoCursor.foreach(MongoCursor.scala:497)
        ...

This seems to be happening at random, even in cases where mongo shouldn't be returning any results from the query. The size reported is inconsistent and normally way larger than it should or could be.

I'm guessing this is probably some form of corruption with the response. I've had a difficult time making heads or tails of this problem using Wireshark, but I consistently find that the request/response chain leading up to the query whose response throws this error has "TCP Window Full" response coming from MongoDB:

The versions I'm using:


 Casbah: 2.1.5.0
 Mongo Java Driver: 2.5.3
 MongoDB: 2.2

I'd greatly appreciate it if anyone could give any advice on what I may potentially be doing wrong or any pointers on how to further debug this issue

UPDATE: After looking at the release notes for Casbah 2.1.5.0, it appears that the version of the java driver being used is 2.5.3, not 2.7.3

解决方案

The version of the Java driver you're using is not compatible with MongoDB 2.2. You should be using at least 2.9.3, if not 2.10 or higher. There's no guarantee a driver upgrade will fix your problem, but it should be a first step.

https://support.mongolab.com/entries/22631012-which-drivers-support-mongodb-2-2

这篇关于为什么我最终得到Casbah / Java MongoDB驱动程序的java.lang.IllegalArgumentException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆