Mongo Health Indicator is showing UncategorizedMongoDbException
abecedarius opened this issue · 1 comments
Hi team,
We have used the custom MongoConfiguration by extending the AbstractMongoConfiguration in our application. We have configured the below properties.
We have used Spring Boot 2.0.1.RELEASE, Spring data Mongo 2.0.6.RELEASE
mongo.connection.timeout=2000
mongo.socket.timeout=5000
mongo.server.selection.time=2000
mongo.max.connection.per.host=100
mongo.client.thread.allowed=4
mongo.max.wait.time=2000
mongo.connection.uri=mongodb://localhost:27017/testDB?serverSelectionTimeoutMS=2000&connectTimeoutMS=2000&maxIdleTimeMS=15000&maxLifeTimeMS=600000
mongo.db.name=testDB
mongo.client.read.concern=LOCAL
mongo.client.write.concern=1
mongo.client.write.timeout=5000
mongo.write.concern.journal=true
mongo.write.timeout.unit=MILLISECONDS
mongo.client.read.preference=PRIMARY
cache.expire.time=3600000
But getting the below exception for the mongo health check monitor.
Not sure what may be causing this:
org.springframework.boot.actuate.mongo.MongoHealthIndicator:89 - MongoDB health check failed
org.springframework.data.mongodb.UncategorizedMongoDbException: Exception sending message; nested exception is com.mongodb.MongoSocketWriteException: Exception sending message
at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:131) ~[spring-data-mongodb-2.0.7.RELEASE.jar!/:2.0.7.RELEASE]
at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2589) ~[spring-data-mongodb-2.0.7.RELEASE.jar!/:2.0.7.RELEASE]
at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:499) ~[spring-data-mongodb-2.0.7.RELEASE.jar!/:2.0.7.RELEASE]
at org.springframework.data.mongodb.core.MongoTemplate.executeCommand(MongoTemplate.java:403) ~[spring-data-mongodb-2.0.7.RELEASE.jar!/:2.0.7.RELEASE]
at org.springframework.boot.actuate.mongo.MongoHealthIndicator.doHealthCheck(MongoHealthIndicator.java:46) ~[spring-boot-actuator-2.0.2.RELEASE.jar!/:2.0.2.RELEASE]
at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:84) ~[spring-boot-actuator-2.0.2.RELEASE.jar!/:2.0.2.RELEASE]
at org.springframework.boot.actuate.health.CompositeHealthIndicator.health(CompositeHealthIndicator.java:68) ~[spring-boot-actuator-2.0.2.RELEASE.jar!/:2.0.2.RELEASE]
at org.springframework.boot.actuate.health.HealthEndpointWebExtension.getHealth(HealthEndpointWebExtension.java:50) ~[spring-boot-actuator-2.0.2.RELEASE.jar!/:2.0.2.RELEASE]
at sun.reflect.GeneratedMethodAccessor101.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_161]
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:223) ~[spring-core-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
at org.springframework.boot.actuate.endpoint.invoke.reflect.ReflectiveOperationInvoker.invoke(ReflectiveOperationInvoker.java:76) ~[spring-boot-actuator-2.0.2.RELEASE.jar!/:2.0.2.RELEASE]
at org.springframework.boot.actuate.endpoint.annotation.AbstractDiscoveredOperation.invoke(AbstractDiscoveredOperation.java:61) ~[spring-boot-actuator-2.0.2.RELEASE.jar!/:2.0.2.RELEASE]
at org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$ServletWebOperationAdapter.handle(AbstractWebMvcEndpointHandlerMapping.java:243) [spring-boot-actuator-2.0.2.RELEASE.jar!/:2.0.2.RELEASE]
at org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(AbstractWebMvcEndpointHandlerMapping.java:299) [spring-boot-actuator-2.0.2.RELEASE.jar!/:2.0.2.RELEASE]
at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_161]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209) [spring-web-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) [spring-web-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) [spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877) [spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783) [spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) [spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
Not able to find out what may be causing this exception. Please suggest how to resolve this.
Regards,
Vivek
That's not a general issue/discussion forum for Spring Boot/Spring Data MongoDB issues.
Looking at the exception, it's caused by MongoSocketWriteException
which indicates an underlying I/O problem such as a non-responsive MongoDB server. If this problem persists, post a question on StackOverflow long with the full stack trace. The one here is truncated.