Монго тайм-аут на сохранение

Я сталкиваюсь с проблемой с использованием Spring-Data-Mongo (1.5.2) и Mongo-Java-драйвера 2.9.2. Этот проект находится в пружинном контейнере и используется как банка в другом приложении. Функциональные тесты работают нормально (сохранение, получение, все), но когда я включаю этот jar-файл в другое приложение, я получаю необходимый DAO, затем могу получить объекты, но не сохранить их. Я получаю ошибку

com.mongodb.MongoTimeoutException: Превышено время ожидания ожидания сервера, который соответствует {serverSelectors=[ReadPreferenceServerSelector{readPreference=primary}, LatencyMinimizingServerSelector{acceptLatencyDifference=15 мс}]} после 10000 мс

Я начинаю думать, что это связано с тем, что транзакция была потеряна при извлечении dao/repository в (не Spring-) приложение.

РЕДАКТИРОВАТЬ: Нет, это не потеряно, поскольку я пытался включить банку в другое приложение, и это работало... Это должно быть что-то не так в первом приложении.

Это результат выполнения rs.status() на первичном

{
        "set" : "mongodb.vms",
        "date" : ISODate("2014-08-29T06:54:04Z"),
        "myState" : 1,
        "members" : [
                {
                        "_id" : 0,
                        "name" : "server1-webtec-vm01:27017",
                        "health" : 1,
                        "state" : 1,
                        "stateStr" : "PRIMARY",
                        "uptime" : 1191318,
                        "optime" : Timestamp(1408545246, 2),
                        "optimeDate" : ISODate("2014-08-20T14:34:06Z"),
                        "electionTime" : Timestamp(1408104842, 1),
                        "electionDate" : ISODate("2014-08-15T12:14:02Z"),
                        "self" : true
                },
                {
                        "_id" : 1,
                        "name" : "server2-webtec-vm02.ch.mycompany.net:27017",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 1191317,
                        "optime" : Timestamp(1408545246, 2),
                        "optimeDate" : ISODate("2014-08-20T14:34:06Z"),
                        "lastHeartbeat" : ISODate("2014-08-29T06:54:03Z"),
                        "lastHeartbeatRecv" : ISODate("2014-08-29T06:54:03Z"),
                        "pingMs" : 0,
                        "syncingTo" : "server1-webtec-vm01:27017"
                }
        ],
        "ok" : 1
}

Здесь все исключение:

Not able to start the 'ch.MYCOMPANY.escenic.engine.service.MongoCountryService' service
org.springframework.dao.DataAccessResourceFailureException: Timed out while waiting for a server that matches {serverSelectors=[ReadPreferenceServerSelector{readPreference=primary}, LatencyMinimizingServerSelector{acceptableLatencyDifference=15 ms}]} after 10000 ms; nested exception is com.mongodb.MongoTimeoutException: Timed out while waiting for a server that matches {serverSelectors=[ReadPreferenceServerSelector{readPreference=primary}, LatencyMinimizingServerSelector{acceptableLatencyDifference=15 ms}]} after 10000 ms
        at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:71)
        at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:1918)
        at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:412)
        at org.springframework.data.mongodb.core.MongoTemplate.saveDBObject(MongoTemplate.java:945)
        at org.springframework.data.mongodb.core.MongoTemplate.doSave(MongoTemplate.java:885)
        at org.springframework.data.mongodb.core.MongoTemplate.save(MongoTemplate.java:833)
        at org.springframework.data.mongodb.repository.support.SimpleMongoRepository.save(SimpleMongoRepository.java:72)
        at org.springframework.data.mongodb.repository.support.SimpleMongoRepository.save(SimpleMongoRepository.java:87)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:405)
        at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:390)
        at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:344)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at com.sun.proxy.$Proxy30.save(Unknown Source)
        at ch.MYCOMPANY.escenic.engine.service.MongoCountryService.checkCountries(MongoCountryService.java:133)
        at ch.MYCOMPANY.escenic.engine.service.MongoCountryService.startService(MongoCountryService.java:35)
        at neo.nursery.AbstractNurseryService.doStartService(AbstractNurseryService.java:245)
        at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.escenic.phoenix.admin.servlet.ECEBrowserHelper.displayMethod(ECEBrowserHelper.java:343)
        at org.apache.jsp.browser_jsp._jspService(browser_jsp.java:160)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at com.escenic.servlet.TopFilter.doFilterImpl(TopFilter.java:135)
        at com.twelvemonkeys.servlet.GenericFilter.doFilter(GenericFilter.java:208)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
        at com.googlecode.psiprobe.Tomcat70AgentValve.invoke(Tomcat70AgentValve.java:38)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)
Caused by: com.mongodb.MongoTimeoutException: Timed out while waiting for a server that matches {serverSelectors=[ReadPreferenceServerSelector{readPreference=primary}, LatencyMinimizingServerSelector{acceptableLatencyDifference=15 ms}]} after 10000 ms
        at com.mongodb.BaseCluster.getServer(BaseCluster.java:87)
        at com.mongodb.DBTCPConnector.getServer(DBTCPConnector.java:654)
        at com.mongodb.DBTCPConnector.access$300(DBTCPConnector.java:39)
        at com.mongodb.DBTCPConnector$MyPort.getConnection(DBTCPConnector.java:503)
        at com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:451)
        at com.mongodb.DBTCPConnector.getPrimaryPort(DBTCPConnector.java:409)
        at com.mongodb.DBCollectionImpl.update(DBCollectionImpl.java:263)
        at com.mongodb.DBCollection.update(DBCollection.java:191)
        at com.mongodb.DBCollection.save(DBCollection.java:975)
        at com.mongodb.DBCollection.save(DBCollection.java:934)
        at org.springframework.data.mongodb.core.MongoTemplate$10.doInCollection(MongoTemplate.java:950)
        at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:410)
        ... 53 more

0 ответов

Другие вопросы по тегам