com.mongodb.MongoTimeoutException: Timed out while waiting for a server that matches AnyServerSelector{} after 10000 ms

JIRA | Jyoti Das | 2 years ago
  1. 0

    {noformat} Exception in thread "main" com.mongodb.MongoTimeoutException: Timed out while waiting for a server that matches AnyServerSelector{} 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.insert(DBCollectionImpl.java:182) at com.mongodb.DBCollectionImpl.insert(DBCollectionImpl.java:165) at com.mongodb.DBCollection.insert(DBCollection.java:161) at com.mongodb.DBCollection.insert(DBCollection.java:107) at com.mongodb.DBCollection.save(DBCollection.java:966) at com.mongodb.DBCollection.save(DBCollection.java:934) at com.mongodb.gridfs.GridFSInputFile._dumpBuffer(GridFSInputFile.java:281) at com.mongodb.gridfs.GridFSInputFile.saveChunks(GridFSInputFile.java:231) at com.mongodb.gridfs.GridFSInputFile.save(GridFSInputFile.java:177) at com.mongodb.gridfs.GridFSInputFile.save(GridFSInputFile.java:158) at es.db.mongodb.MongodbTest.main(MongodbTest.java:76) {noformat} The code: {code:java} public class MongodbTest { public static void main(String[] args) throws IOException { System.out.println("Entered mongotest"); MongoClient mongoClient = new MongoClient("192.168.1.214", 27017); //http://api.mongodb.org/java/2.10.1/com/mongodb/MongoClient.html //A MongoDB client with internal connection pooling. For most applications, //you should have one MongoClient instance for the entire JVM. DB db = mongoClient.getDB("test"); DBCollection collection = db.getCollection("downloads_meta"); String filePath = "C:\\axd\\dell_fig1.jpg"; File file = new File(filePath); GridFS gridfs = new GridFS(db, "downloads"); GridFSInputFile gfsFile = gridfs.createFile(file); gfsFile.setFilename("dell_fig1.jpg"); gfsFile.save(); //It crashes here. BasicDBObject info = new BasicDBObject(); info.put("name", "Dell"); info.put("fileName", "dell_fig1.jpg"); info.put("rawName", "dell_fig1.jpg"); info.put("rawPath", "C:\\axd"); collection.insert(info, WriteConcern.SAFE); } } {code}

    JIRA | 2 years ago | Jyoti Das
    com.mongodb.MongoTimeoutException: Timed out while waiting for a server that matches AnyServerSelector{} after 10000 ms
  2. 0

    {noformat} Exception in thread "main" com.mongodb.MongoTimeoutException: Timed out while waiting for a server that matches AnyServerSelector{} 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.insert(DBCollectionImpl.java:182) at com.mongodb.DBCollectionImpl.insert(DBCollectionImpl.java:165) at com.mongodb.DBCollection.insert(DBCollection.java:161) at com.mongodb.DBCollection.insert(DBCollection.java:107) at com.mongodb.DBCollection.save(DBCollection.java:966) at com.mongodb.DBCollection.save(DBCollection.java:934) at com.mongodb.gridfs.GridFSInputFile._dumpBuffer(GridFSInputFile.java:281) at com.mongodb.gridfs.GridFSInputFile.saveChunks(GridFSInputFile.java:231) at com.mongodb.gridfs.GridFSInputFile.save(GridFSInputFile.java:177) at com.mongodb.gridfs.GridFSInputFile.save(GridFSInputFile.java:158) at es.db.mongodb.MongodbTest.main(MongodbTest.java:76) {noformat} The code: {code:java} public class MongodbTest { public static void main(String[] args) throws IOException { System.out.println("Entered mongotest"); MongoClient mongoClient = new MongoClient("192.168.1.214", 27017); //http://api.mongodb.org/java/2.10.1/com/mongodb/MongoClient.html //A MongoDB client with internal connection pooling. For most applications, //you should have one MongoClient instance for the entire JVM. DB db = mongoClient.getDB("test"); DBCollection collection = db.getCollection("downloads_meta"); String filePath = "C:\\axd\\dell_fig1.jpg"; File file = new File(filePath); GridFS gridfs = new GridFS(db, "downloads"); GridFSInputFile gfsFile = gridfs.createFile(file); gfsFile.setFilename("dell_fig1.jpg"); gfsFile.save(); //It crashes here. BasicDBObject info = new BasicDBObject(); info.put("name", "Dell"); info.put("fileName", "dell_fig1.jpg"); info.put("rawName", "dell_fig1.jpg"); info.put("rawPath", "C:\\axd"); collection.insert(info, WriteConcern.SAFE); } } {code}

    JIRA | 2 years ago | Jyoti Das
    com.mongodb.MongoTimeoutException: Timed out while waiting for a server that matches AnyServerSelector{} after 10000 ms
  3. 0

    MongoDB plugin - how to make it to not create a datasource during testing?

    Stack Overflow | 1 year ago | dic19
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTransactionManager': Cannot resolve reference to bean 'mongoDatastore' while setting bean property 'datastore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoDatastore': FactoryBean threw exception on object creation; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Timed out while waiting for a server that matches AnyServerSelector{} after 10000 ms; nested exception is com.mongodb.MongoTimeoutException: Timed out while waiting for a server that matches AnyServerSelector{} after 10000 ms
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    today i just update spring.data.mongodb.version from v1.4.1 to v1.6.0 in pom.xml, then I get a exception when startup: {noformat} Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in ServletContext resource [/WEB-INF/azeleaContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.data.mongodb.core.MongoTemplate]: Constructor threw exception; nested exception is com.mongodb.MongoTimeoutException: Timed out while waiting for a server that matches AnyServerSelector{} after 10000 ms at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:278) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1133) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1036) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:505) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:725) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4994) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5492) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.data.mongodb.core.MongoTemplate]: Constructor threw exception; nested exception is com.mongodb.MongoTimeoutException: Timed out while waiting for a server that matches AnyServerSelector{} after 10000 ms at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:125) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:270) ... 23 more Caused by: com.mongodb.MongoTimeoutException: Timed out while waiting for a server that matches AnyServerSelector{} 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.createIndex(DBCollectionImpl.java:339) at com.mongodb.DBCollection.createIndex(DBCollection.java:564) at org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator.createIndex(MongoPersistentEntityIndexCreator.java:136) at org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator.checkForAndCreateIndexes(MongoPersistentEntityIndexCreator.java:129) at org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator.checkForIndexes(MongoPersistentEntityIndexCreator.java:121) at org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator.<init>(MongoPersistentEntityIndexCreator.java:87) at org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator.<init>(MongoPersistentEntityIndexCreator.java:64) at org.springframework.data.mongodb.core.MongoTemplate.<init>(MongoTemplate.java:218) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) ... 25 more {noformat} what's the problem? I changed nothing else anywhere, and I checked the new reference document and find no idea. I just want know if new release support $not operator because I wrote " @Query("{'to':?0,'type':{'$not':'/update.*/'}}") " under v1.4.1 but I am prompted $not is not support sorry for format problem, you know it's very difficult to visit website overseas now since google CDN services are blocked by China government

    Spring JIRA | 2 years ago | deng hui
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in ServletContext resource [/WEB-INF/azeleaContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.data.mongodb.core.MongoTemplate]: Constructor threw exception; nested exception is com.mongodb.MongoTimeoutException: Timed out while waiting for a server that matches AnyServerSelector{} after 10000 ms
  6. 0

    [mongodb-user] JDBC 2.12.3 - tutorial to create new document - AnyServerSelector - Grokbase

    grokbase.com | 1 year ago
    com.mongodb.MongoTimeoutException: Timed out while waiting for a server that matches AnyServerSelector{} after 10000 ms

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.mongodb.MongoTimeoutException

      Timed out while waiting for a server that matches AnyServerSelector{} after 10000 ms

      at com.mongodb.BaseCluster.getServer()
    2. MongoDB Java Driver
      GridFSInputFile.save
      1. com.mongodb.BaseCluster.getServer(BaseCluster.java:87)
      2. com.mongodb.DBTCPConnector.getServer(DBTCPConnector.java:654)
      3. com.mongodb.DBTCPConnector.access$300(DBTCPConnector.java:39)
      4. com.mongodb.DBTCPConnector$MyPort.getConnection(DBTCPConnector.java:503)
      5. com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:451)
      6. com.mongodb.DBTCPConnector.getPrimaryPort(DBTCPConnector.java:409)
      7. com.mongodb.DBCollectionImpl.insert(DBCollectionImpl.java:182)
      8. com.mongodb.DBCollectionImpl.insert(DBCollectionImpl.java:165)
      9. com.mongodb.DBCollection.insert(DBCollection.java:161)
      10. com.mongodb.DBCollection.insert(DBCollection.java:107)
      11. com.mongodb.DBCollection.save(DBCollection.java:966)
      12. com.mongodb.DBCollection.save(DBCollection.java:934)
      13. com.mongodb.gridfs.GridFSInputFile._dumpBuffer(GridFSInputFile.java:281)
      14. com.mongodb.gridfs.GridFSInputFile.saveChunks(GridFSInputFile.java:231)
      15. com.mongodb.gridfs.GridFSInputFile.save(GridFSInputFile.java:177)
      16. com.mongodb.gridfs.GridFSInputFile.save(GridFSInputFile.java:158)
      16 frames
    3. es.db.mongodb
      MongodbTest.main
      1. es.db.mongodb.MongodbTest.main(MongodbTest.java:76)
      1 frame