我正在尝试使用 Morphia 遍历我的 MongoDB 数据库中的所有行(“文档”?)。有时我会得到以下堆栈跟踪:
com.mongodb.MongoInternalException: can't do getmore
at com.mongodb.DBApiLayer$Result._advance(DBApiLayer.java:378)
at com.mongodb.DBApiLayer$Result.hasNext(DBApiLayer.java:356)
at com.mongodb.DBCursor._hasNext(DBCursor.java:436)
at com.mongodb.DBCursor.hasNext(DBCursor.java:456)
at com.google.code.morphia.query.MorphiaIterator.hasNext(MorphiaIterator.java:40)
at
在 MongoDB 日志文件中,我看到以下内容:
$ grep "cursorid not found" output.log
Sun Feb 6 12:14:35 [conn13] getMore: cursorid not found App 2079575931792020691
Sun Feb 6 12:44:17 [conn19] getMore: cursorid not found App 8364953818630631317
Sun Feb 6 13:08:42 [conn20] getMore: cursorid not found App 7142256996888968009
我的迭代代码非常简单:
for (App app : datastore.createQuery(App.class).fetch())
{
log.info("app: " + app.getId());
// do stuff with app
}
吗啡虫?MongoDB 错误?我的虫子?
更新:
我也在我的 glassfish 日志中看到了这一点:
[#|2011-02-16T15:39:58.029+0000|WARNING|glassfish3.0.1|com.mongodb.TRACE|_ThreadID=28;_ThreadName=Thread-1;|The log message is null.
java.lang.NullPointerException
at com.mongodb.DBApiLayer._cleanCursors(DBApiLayer.java:113)
at com.mongodb.DBApiLayer$DBCleanerThread.run(DBApiLayer.java:494)
at java.lang.Thread.run(Thread.java:662)