Rate This Document
Findability
Accuracy
Completeness
Readability

"UnknownHostException: fastdl.mongodb.org" Displayed When Compiling Spring Boot

Symptom

The message "java.net.UnknownHostException: fastdl.mongodb.org" is displayed during the Spring Boot compilation.

Key Process and Cause Analysis

The host is not mapped. Add proxy configurations to solve the problem.

Conclusion and Solution

Modify the EmbeddedMongoAutoConfiguration.java source code.

  1. Open the EmbeddedMongoAutoConfiguration.java file.
    vim ./spring-boot-project/spring-boot-autoconfigure//src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java
  2. Press i to enter the insert mode and modify the following content.
    • Add the following content below line 43:
      import de.flapdoodle.embed.process.config.store.HttpProxyFactory;
    • Modify the code in line 220 as follows:
      IDownloadConfig downloadConfig = downloadConfigBuilder.proxyFactory(new HttpProxyFactory("127.0.0.1",3128)).build();

      In the preceding example, 127.0.0.1 and 3128 indicate the IP address and port number of the proxy host. Replace them with the actual ones.

      Run the :set list command to check the format. Spaces are not allowed. Use Tab to indent the code.

  3. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Recompile Spring Boot.