MongoDB 3.0 Java Driver在Linux Server下多线程插入数据异常

发布问题 回首页

MongoDB 3.0 Java Driver在Linux Server下多线程插入数据异常

★ 0 成为第一个关注这个问题的人

使用MongoDB 3.0版本,部署环境为vSphere构建虚拟机,使用Java driver(3.0.0rc1)多线程写入数据到MongoDB,异常信息如下所示:
Caused by: java.lang.NullPointerException
at com.mongodb.connection.ProtocolHelper.isCommandOk(ProtocolHelper.java:61)
at com.mongodb.connection.WriteCommandProtocol.receiveMessage(WriteCommandProtocol.java:189)
at com.mongodb.connection.WriteCommandProtocol.execute(.java:76)
at com.mongodb.connection.InsertCommandProtocol.execute(InsertCommandProtocol.java:66)
at com.mongodb.connection.InsertCommandProtocol.execute(InsertCommandProtocol.java:37)
at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:155)
at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:219)
at com.mongodb.connection.DefaultServerConnection.insertCommand(DefaultServerConnection.java:108)
at com.mongodb.operation.MixedBulkWriteOperation$Run$2.executeWriteCommandProtocol(MixedBulkWriteOperation.java:416)
at com.mongodb.operation.MixedBulkWriteOperation$Run$RunExecutor.execute(MixedBulkWriteOperation.java:604)
at com.mongodb.operation.MixedBulkWriteOperation$Run.execute(MixedBulkWriteOperation.java:363)
at com.mongodb.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:148)
at com.mongodb.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:141)
at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:186)
at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:177)
at com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:141)
at com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:72)
at com.mongodb.Mongo.execute(Mongo.java:745)
at com.mongodb.Mongo$2.execute(Mongo.java:728)
at com.mongodb.MongoCollectionImpl.executeSingleWriteRequest(MongoCollectionImpl.java:482)
at com.mongodb.MongoCollectionImpl.insertOne(MongoCollectionImpl.java:277)

该异常为偶发性异常,在Windows上,Eclipse环境下,多线程测试,该异常完全不发生,当代码迁移到虚拟服务器上时,该异常偶尔发生;

有大牛遇到过类似情况吗?求教..

windofthesky 在大约 之前添加了 Open 状态
  • 提问于
  • Answers0 个
  • 浏览 622 次
  • 最新活跃于
To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create