MongoException in Replica set in version 3.2

From: srikaanth k <srikaanthks@xxxxxxxxx>
To: mongodb-user <mongodb-user@xxxxxxxxxxxxxxxx>
Date: Sat, 7 May 2016 02:24:57 -0700 (PDT)
Why ads?
Hi ,

Please help me to sort out the issue am facing last one month . 

We have set a mongo Replica with 3 host (host1, host2, host3).

We have using java methods to insert and update collections .

We facing problem : when a mongo (host1) which is primary in replica and 
our java project which is in host1 tried to insert a row in collection 
using java . We got following error. But if my project in host1 and mongo 
connection to host2, it insert successfully. 


exception : 

org.springframework.web.util.NestedServletException: Handler processing 
failed; nested exception is java.lang.NoClassDefFoundError: 
com/mongodb/MongoException$DuplicateKey
org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1259)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:917)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:813)
javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:798)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause: 

java.lang.NoClassDefFoundError: com/mongodb/MongoException$DuplicateKey
org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:51)
org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:1665)
org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:374)
org.springframework.data.mongodb.core.MongoTemplate.collectionExists(MongoTemplate.java:436)
org.springframework.data.mongodb.core.MongoTemplate.collectionExists(MongoTemplate.java:432)
com.product.cluster.adpay.utils.MongoServiceConnector.saveAdPayStats(MongoServiceConnector.java:92)
com.product.cluster.adpay.client.MongoDbController.save(MongoDbController.java:72)
com.product.cluster.adpay.client.MongoDbController.doSaveMongo(MongoDbController.java:61)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:917)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:813)
javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:798)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

-- 
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.org/manual/support/
--- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to mongodb-user@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/fd022414-9b88-4240-ae2d-43943e5c1264%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Why ads?