Reputation: 21
Upgrading one of our service to Java 21 and Spring boot 3.1.5. Service contains Embedded Mongo db and has been updated as below.
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo.spring30x</artifactId>
<version>4.11.0</version>
<scope>test</scope>
</dependency>
However, All the unit and integration tests are getting executed without any issues in local but failing in gitlab runner.
How do we resolve this error?.
Below is the error message for the same.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'syncClientServerWrapper' defined in class path resource
Caused by: java.lang.RuntimeException: could not start process at
de.flapdoodle.embed.mongo.transitions.MongoServerStarter.result(MongoServerStarter.java:129)
at de.flapdoodle.reverse.TransitionWalker.resolve(TransitionWalker.java:58)
at de.flapdoodle.reverse.TransitionWalker.resolve(TransitionWalker.java:46)
at de.flapdoodle.reverse.TransitionWalker.initState(TransitionWalker.java:180)
... 102 common frames omitted
Caused by: java.io.IOException: Cannot run program
"/root/.embedmongo/fileSets
/4b177cbd88668a95edf49714fa2964a4a940f94feb0f2b0e279810a865d7d313/mongod"
(in directory "/tmp/temp--033a8268-15b0-4a18-b06b-1f5a6901c65f/
workingDir1858686435819966950"): error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1170)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1089)
at de.flapdoodle.embed.process.runtime.ProcessControl.start(ProcessControl.java:177)
at de.flapdoodle.embed.process.types.RunningProcess.start(RunningProcess.java:76)
at de.flapdoodle.embed.mongo.transitions.MongoServerStarter.result(MongoServerStart
Tried various ways to resolve this but not able to solve this problem. Because of this we need to downgrade to Java 17.
Upvotes: 2
Views: 1005
Reputation: 1
It's possible the image you are using for your runner is not compatible with embedded mongo. In my case, I was using an apline image for gradle, which was causing issues. Switching to using an non apline image i.e gradle:jdk-11 was able to resolve the problem.
To be more specific Apline linux does not use glibc which is a library needed by flapdoodle embded mongo. The best solution would be to either use a different image that contains the glibc libraries or to install a compatibility layer such as gcompat onto your Alpine image.
See more on this https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo/issues/281 https://wiki.alpinelinux.org/wiki/Running_glibc_programs
Upvotes: 0