Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3274

MongoSocketOpenException: Exception opening socket

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 4.0.0
    • Fix Version/s: None
    • Component/s: API, Connection Management
    • Labels:
      None
    • Environment:
      Linux

      Description

      com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception=

      {com.mongodb.MongoSocketOpenException: Exception opening socket}

      , caused by {java.net.ConnectException: Connection refused (Connection refused)}}]
      at com.mongodb.connection.BaseCluster.createTimeoutException(BaseCluster.java:370)
      at com.mongodb.connection.BaseCluster.selectServer(BaseCluster.java:101)
      at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.<init>(ClusterBinding.java:75)
      at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.<init>(ClusterBinding.java:71)
      at com.mongodb.binding.ClusterBinding.getReadConnectionSource(ClusterBinding.java:63)
      at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:166)
      at com.mongodb.operation.ListCollectionsOperation.execute(ListCollectionsOperation.java:172)
      at com.mongodb.operation.ListCollectionsOperation.execute(ListCollectionsOperation.java:80)
      at com.mongodb.Mongo.execute(Mongo.java:738)
      at com.mongodb.Mongo$2.execute(Mongo.java:725)
      at com.mongodb.OperationIterable.iterator(OperationIterable.java:47)
      at com.mongodb.OperationIterable.forEach(OperationIterable.java:70)
      at com.mongodb.MappingIterable.forEach(MappingIterable.java:50)
      at com.mongodb.MappingIterable.into(MappingIterable.java:60)
      at com.mongodb.DB.getCollectionNames(DB.java:224)
      at com.mongodb.DB.collectionExists(DB.java:412)
      at org.springframework.data.mongodb.core.MongoTemplate$6.doInDB(MongoTemplate.java:517)
      at org.springframework.data.mongodb.core.MongoTemplate$6.doInDB(MongoTemplate.java:515)
      at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:445)
      at org.springframework.data.mongodb.core.MongoTemplate.collectionExists(MongoTemplate.java:515)
      at org.springframework.data.mongodb.core.MongoTemplate.collectionExists(MongoTemplate.java:511)
      at com.gazelle.mongo.repository.PIRMongoService.insertData(PIRMongoService.java:33)
      at com.gazelle.modules.api.controllers.PIRDataApiController.savePirData(PIRDataApiController.java:55)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222)
      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737)
      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
      at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:871)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
      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.gazelle.modules.web.mvc.interceptor.CrossOriginResourceFilter.doFilterInternal(CrossOriginResourceFilter.java:22)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: