gpt4 book ai didi

java - MongoDB Java驱动程序-java.net.SocketException:连接重置

转载 作者:行者123 更新时间:2023-12-03 15:59:38 30 4
gpt4 key购买 nike

我们有一个复制设置,其中有运行mongodb社区服务器v3.4.16的主,辅助和仲裁节点。

我们正在使用jasperserver从mongodb数据库生成100多个报告。

最近,由于报告随机失败,我们开始在连接到mongodb服务器时遇到连接重置问题。

该应用程序(jasperserver)和mongodb位于同一网络中,并且它们之间没有防火墙。

有人可以提供任何指示以进一步调查根本原因,以便将其解决吗?

2018-12-07 03:46:00,631错误MongoDbConnectionFactory,quartzScheduler_Worker-34:85-无法验证对象;原因:无法测试MongoDB连接;引起原因:接收消息异常2018-12-07 03:46:00,631错误MongoDbConnectionFactory,quartzScheduler_Worker-34:85-无法验证对象;原因:无法测试MongoDB连接;由以下原因引起:接收messagenet.sf.jasperreports.engine.JR的异常:无法测试MongoDB连接;引起原因:com.jaspersoft.mongodb.connection.MongoDbConnectionFactory.validateObject(MongoDbConnectionFactory.java:83)com.jaspersoft.mongodb.connection.MongoDbConnectionFactory.validateObject(MongoDbConnectionFactory.java:83)处com.jaspersoft.mongodb.connection.MongoDbConnection.test(MongoDbConnection.java:193)处的异常接收消息org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1165)处的.connection.MongoDbConnectionFactory.validateObject(MongoDbConnectionFactory.java:29)在com.jaspersoft.mongodb.connection.MongoDbConnectionManager.borrowConnection(MongoDbConnectionManager.java com.jaspersoft.mongodb.jasperserver。 com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.Engi上的engine.jasperreports.service.impl.EngineServiceImpl.fillReport(EngineServiceImpl.java:1806) com.jaspersoft.jasperserver.api上的neServiceImpl $ ReportFill.runWithDataSource(EngineServiceImpl.java:1143)位于com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl $ ReportFill.runReport(EngineServiceImpl.java:1072)。 com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl $ SynchronousExecutor.execute(EngineServiceImpl.java:945)处的engine.jasperreports.service.impl.EngineServiceImpl $ ReportRunnable.run(EngineServiceImpl.java:967) com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.executeReportUnitRequest(EngineServiceImpl.java)上的com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.fillReport(EngineServiceImpl.java:651) :2068),位于com.jaspersoft.jasperserver.api.engine.jasperreports.domain.impl.ReportUnitRequest.execute(ReportUnitRequest.java:67),位于com.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.execute (EngineServiceImpl.java:529)在com.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.executeReport(ReportExecutionJob.java)上的com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.runReport(ReportExecutionJob.java:836) com.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.executeAndSendReport(Reportjava :)上的com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.executeReport(ReportExecutionJob.java:704) com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.execute(ReportExecutionJob.java:248)在org.quartz.core.JobRunShell.run(JobRunShell.java:213)在org.quartz.simpl.SimpleThreadPool $ WorkerThread.run(SimpleThreadPool.java:557)造成原因:com.mongodb.MongoSocketReadException:com.mongodb.connection.InternalStreamConnection.receiveMessage(com.mongodb.connection.InternalStreamConnection.translateReadException(InternalStreamConnection.java:480)处的异常接收消息英特纳com.mongodb.connection.UsageTrackingInternalConnection.receiveMessage(UsageTrackingInternalConnection.java:102)处的lStreamConnection.java:225)com.mongodb.connection.CommandProtocol处的com.mongodb.connection.DefaultConnectionPool $ PooledConnection.receiveMessage(DefaultConnectionPool.java:435)处的lStreamConnection.java:225) com.mongodb.connection.DefaultServer的.execute(CommandProtocol.java:112)在com.mongodb处的com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:286)处的com.mongodb.connection.DefaultServer $ DefaultServerProtocolExecutor.execute(DefaultServer.java:159) com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandgoperationHelper.java:186)处com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:215)处的connection.DefaultServerConnection.command(DefaultServerConnection.java:173) .operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:178)位于com.mongodb.operation.CommandOperationH com.mongodb.operation.CommandReadOperation.execute(CommandReadOperation.java:55)处com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:84)处的elper.executeWrappedCommandProtocol(CommandOperationHelper.java:91) .comute(Mongo.java:772)在com.mongodb.Mongo $ 2.execute(Mongo.java:759)在com.mongodb.DB.executeCommand(DB.java:653)在com.mongodb.DB.command(DB com.mongodb.DB.command(DB.java:439)的.java:423)com.jaspersoft.mongodb.connection.MongoDbConnection.test(MongoDbConnection)的com.mongodb.DB.command(DB.java:381)处的。 java:188)... 22更多原因:java.net.SocketException:java.net.SocketInputStream.read(SocketInputStream.java:141)处的java.net.SocketInputStream.read(SocketInputStream.java:210)处的连接重置com.mongodb.connection.Int上的com.mongodb.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:491)上的com.mongodb.connection.SocketStream.read(SocketStream.java:85) ernalStreamConnection.receiveMessage(InternalStreamConnection.java:221)...还有41个

最佳答案

使用本机java mongodb驱动程序时,我遇到了类似的问题。这就是问题-net.ipv4.tcp_keepalive_time = 7200,这意味着在这种情况下,MONGO Server将切断life&maxConnectionIdleTime的连接柱7200,并且未设置(无限)。终止后,连接仍将保留在连接池中,但过时了,会创建此异常。

我建议您-
 ->将socketKeepAlive设置为true(在本机驱动程序的最新版本中默认为true)
 ->以这种方式设置maxConnectionIdleTime

关于java - MongoDB Java驱动程序-java.net.SocketException:连接重置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53703904/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com