Unable to download embedded MongoDB, behind proxy, using automatic configuration script Unable to download embedded MongoDB, behind proxy, using automatic configuration script mongodb mongodb

Unable to download embedded MongoDB, behind proxy, using automatic configuration script


What worked for me on a windows machine:

Download the zip file (https://downloads.mongodb.org/win32/mongodb-win32-i386-3.2.2.zip)manually and put it (not unpack) into this folder:

C:\Users\<Username>\.embedmongo\win32\


Indeed the problem is about your proxy (a corporate one I guess).

If the proxy do not require authentication, you can solve your problem easily just by adding the appropriate -Dhttp.proxyHost=... and -Dhttp.proxyPort=... (or/and the same with "https.[...]") as JVM arguments in your eclipse junit Runner, as suggested here : https://github.com/learning-spring-boot/learning-spring-boot-2nd-edition-code/issues/2


One solution to your problem is to do the following.

  1. Download MongoDB and place it on a ftp server which is inside your corporate network (for which you would not need proxy).

  2. Then write a configuration in your project like this

    @Bean@ConditionalOnProperty("mongo.proxy")public IRuntimeConfig embeddedMongoRuntimeConfig() {    final Command command = Command.MongoD;    final IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder()        .defaults(command)        .artifactStore(new ExtractedArtifactStoreBuilder()            .defaults(command)            .download(new DownloadConfigBuilder()                .defaultsForCommand(command)                .downloadPath("your-ftp-path")                .build())            .build())        .build();    return runtimeConfig;}

With the property mongo.proxy you can control whether Spring Boot downloads MongoDB from your ftp server or from outside. If it is set to true then it downloads from the ftp server. If not then it tries to download from the internet.