Closed zakaria-hajjaji closed 1 year ago
@zakaria-hajjaji do you have any error message, stack trace?
yeah i deploy a container on gke this is the error Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'investUserSettingsFilter' defined in URL [jar:file:/usr/share/myservice/iac.jar!/BOOT- .......(some long errors) nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.flapdoodle.embed.mongo.MongodExecutable]: Factory method 'embeddedMongoServer' threw exception; nested exception is de.flapdoodle.embed.process.exceptions.DistributionException: java.io.IOException: Could not open inputStream for https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.5.5.tgz with proxy Optional.empty
for info when i run mvn test and integration-test it pass
@zakaria-hajjaji .. the main issue: i guess that the deployed container can not access https://fastdl.mongodb.org (i guess there is a firewall rule for that) so the download fails.. a second issue: i guess you are using a older version of this library .. there are spring integrations for spring 2.5.x, 2.6.x, 2.7.x, 3.0.x and 3.1.x .. these do not solve the firewall issue, but uses the latest version of this library.
https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo.spring/tree/spring-2.5.x https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo.spring
is there any way to like bypass the firewall or setting a proxy cause i have some proxy things in the project
@zakaria-hajjaji an important function of an firewall is: you can not bypass them.. if a proxy can provide access to the internet you must use this proxy on the CI system..
Here you can find some information how to configure a proxy: https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo/blob/main/docs/Howto.md#customize-proxy-for-download .. and how to apply this customization with spring: https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo.spring/blob/main/HowTo.md#customize-mongod
ahh yes i mean by setting a proxy,okay where exactly i can place the proxy custumize file in the project and which name i willl give
@zakaria-hajjaji is your project on a public git repo? which spring version do you use?
No is not public springboot 2.7.9 and java 17
@zakaria-hajjaji put this:
@Bean
BeanPostProcessor customizeMongod() {
return TypedBeanPostProcessor.applyBeforeInitialization(Mongod.class, src -> {
return Mongod.builder()
.from(src)
.downloadPackage(DownloadPackage.withDefaults()
.withProxyFactory(new HttpProxyFactory("server", 1234)))
.build();
});
}
beside your other bean definitions.. and replace servername and port.
i'll try it now
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedMongoServer' defined in class path resource [org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.class]: Invocation of init method failed; nested exception is java.io.IOException: Cannot run program "/tmp/extract-d4ea2568-e1c9-4a28-a4e5-0bef11220a46extractmongod": error=2, No such file or directory
for info the issue is fixed by adding system.setproperty(proxyhost,....) and port
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedMongoServer' defined in class path resource [org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.class]: Invocation of init method failed; nested exception is java.io.IOException: Cannot run program "/tmp/extract-d4ea2568-e1c9-4a28-a4e5-0bef11220a46extractmongod": error=2, No such file or directory
FOR THIS delete the alpine form based image
@zakaria-hajjaji you should use this newer integration: https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo.spring/tree/spring-2.7.x .. which should give a better error message bc i suspect that this will work on an alpine based image.
okey thank you
Hi when a run mvn integration-test the download pass successfully But in the phase of mvn release:prepare it broks I working of gitlab CI for running jobs