使用mongo-java-driver-3.2.0.jar 报错,偶尔出现,但出现了就只能重启程序了
com.mongodb.MongoSocketReadException: Prematurely reached end of stream
com.mongodb.connection.SocketStream.read(SocketStream.java:88)
com.mongodb.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:491)
com.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:221)
com.mongodb.connection.CommandHelper.receiveReply(CommandHelper.java:134)
com.mongodb.connection.CommandHelper.receiveCommandResult(CommandHelper.java:121)
com.mongodb.connection.CommandHelper.executeCommand(CommandHelper.java:32)
com.mongodb.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:83)
com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:43)
com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115)
com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:127)
同じ問題を解決する方法
問題は解決しましたか?遭遇しました、時々起こりますが、解決方法がわかりません
この問題は、mongodb リンクの数がいっぱいの場合に発生します。解決策: 接続を解放し、インスタンスを再起動します。
同じリクエストですが、どうすれば解決できますか? この問題は、同時挿入に ExecutorService を使用するときによく発生します
mongodb に接続して操作するには、https://github.com/T-baby/Mon... を使用することをお勧めします。666666