403 on Download of Mongo 4.4.1
See original GitHub issueHello 😃 I am using de.flapdoodle.embed.mongo 3.0.0 and here is my code :
RuntimeConfig runtimeConfig = Defaults
.runtimeConfigFor(command)
.artifactStore(Defaults.extractedArtifactStoreFor(command)
.withDownloadConfig(Defaults.downloadConfigFor(command).build())
.executableNaming(new UserTempNaming())).build();
EnumSet<Feature> features = Version.V4_4_1.getFeatures();
IFeatureAwareVersion iFeatureAwareVersion = Versions.withFeatures(Version.V4_4_1, features);
ImmutableMongodConfig mongodConfig = ImmutableMongodConfig.builder()
.version(iFeatureAwareVersion)
.net(new Net(port, true))
.build();
MongodStarter runtime = MongodStarter.getInstance(runtimeConfig);
But I get : Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.4.1.tgz at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1924) at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520) at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:250) at de.flapdoodle.embed.process.store.UrlConnectionDownloader.downloadInputStream(UrlConnectionDownloader.java:130) … 30 more
However, If I switch the version to 4.0.12 for example everything seems fine …
Can you please help ? 😃
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:5 (1 by maintainers)
It looks like MongoDB changed all their URL patterns for download (since 4.2 IIUC looking at this page ; and that would explain why it works for you on 4.0.12).
This means that:
osx
becomesmacos
only in the archive name (the folder name remainsosx
).ssl
part seem to be removed from packages.2008plus
part is replaced with2012plus
for Windows archives.Waiting for a fix, you can try something like:
And then use it like:
(Here is an attempt to have something that works on all OSes but I’ve only tested it on macOS to be honest.)
Since this project recently bumped to version 3, a lot of versions were deprecated. Maybe, to ease the maintenance, they should be removed because it may be a PITA to provide something that works with older and newer versions.
No only have they changed the filename structure of the zip file. Also they have changed the directory name after extraction in a non coherent fashion.
I’ve already changed this for run-rs https://github.com/vkarpov15/run-rs/blob/master/src/download.js#L57