title: how to fix "com.mongodb.MongoSocketOpenException: Exception opening socket" error?
body: <p>I am trying to connect mongodb using spring-boot . while i do that, i have got this error </p>
  
  <pre><code>     [localhost:27107] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server localhost:27107
       com.mongodb.MongoSocketOpenException: Exception opening socket
  </code></pre>
  
  <p>a quick search suggest me to add this in main class </p>
  
  <pre><code>      @SpringBootApplication
        @EnableAutoConfiguration(exclude={MongoAutoConfiguration.class})
  </code></pre>
  
  <p>After i did that,error got away . but the db has not been created in the mongodb and when i check the spring-boot logs ,there is no log related to mongodb . </p>
  
  <p>Attaching my POM.XML here</p>
  
  <pre><code>       &lt;properties&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-mongodb&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.querydsl&lt;/groupId&gt;
          &lt;artifactId&gt;querydsl-mongodb&lt;/artifactId&gt;
          &lt;version&gt;4.1.3&lt;/version&gt;
      &lt;/dependency&gt;
  
  
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;com.mysema.maven&lt;/groupId&gt;
              &lt;artifactId&gt;apt-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.1.3&lt;/version&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;com.querydsl&lt;/groupId&gt;
                      &lt;artifactId&gt;querydsl-apt&lt;/artifactId&gt;
                      &lt;version&gt;4.1.3&lt;/version&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;generate-sources&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;process&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;outputDirectory&gt;target/generated-sources/annotations&lt;/outputDirectory&gt;
                          &lt;processor&gt;
                              org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor
                          &lt;/processor&gt;
                          &lt;logOnlyOnError&gt;true&lt;/logOnlyOnError&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt; 
  </code></pre>
  
  <p>Please let me know if you can help me</p>