flapdoodle-oss / de.flapdoodle.embed.mongo.spring

embedded mongo spring integration
Apache License 2.0
32 stars 7 forks source link

SyncClientServerFactory more than one match #56

Closed neottil closed 3 months ago

neottil commented 3 months ago

I am work with spring boot 3.1.10 and de.flapdoodle.embed.mongo.spring31x 4.11.0. Building the project in java 17 with container-registry.oracle.com/graalvm/graalvm-community:21 image (based on oracle linux) and maven 3.9.6.

The sync client process discover more than one match (Oracle and Amazon), and by default chose Ubuntu20.04. First question is: why Ubuntu if the match is on Oracle and Amazon? during the tests execution I've the error: "Could not start process: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory". How can I solve this?

I saw in the project documentation that there is an option to force OS, but it is not clear to me how to do it for my specific case. I would like to try to force Oracle. Maybe this can resolve the problem of libcrypto.so.1.1, that I presume is a library for Ubuntu 20.04, but not in my Oracle distribution.

Here the stack trace:

build   24-Jun-2024 17:57:08    2024-06-24T15:57:02.216Z  INFO 209 --- [           main] d.f.e.m.s.a.SyncClientServerFactory      : sync server factory
build   24-Jun-2024 17:57:08    2024-06-24T15:57:02.326Z  WARN 209 --- [           main] d.f.os.common.PeculiarityInspector       : more than one match: [Oracle, Amazon]
build   24-Jun-2024 17:57:08    2024-06-24T15:57:02.391Z  WARN 209 --- [           main] d.f.e.m.p.linux.LinuxPackageFinder       : because there is no package for GenericFeatureAwareVersion{6.0.6}:Platform{operatingSystem=Linux, architecture=X86_64} we fall back to GenericFeatureAwareVersion{6.0.6}:Platform{operatingSystem=Linux, architecture=X86_64, version=Ubuntu_20_04}
build   24-Jun-2024 17:57:08    2024-06-24T15:57:03.122Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : starting...
build   24-Jun-2024 17:57:08    2024-06-24T15:57:03.128Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 0 %
build   24-Jun-2024 17:57:08    2024-06-24T15:57:03.320Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 10 %
build   24-Jun-2024 17:57:08    2024-06-24T15:57:03.447Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 20 %
build   24-Jun-2024 17:57:08    2024-06-24T15:57:03.572Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 30 %
build   24-Jun-2024 17:57:08    2024-06-24T15:57:03.657Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 40 %
build   24-Jun-2024 17:57:08    2024-06-24T15:57:03.737Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 50 %
build   24-Jun-2024 17:57:08    2024-06-24T15:57:03.784Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 60 %
build   24-Jun-2024 17:57:08    2024-06-24T15:57:03.824Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 70 %
build   24-Jun-2024 17:57:08    2024-06-24T15:57:03.861Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 80 %
build   24-Jun-2024 17:57:08    2024-06-24T15:57:03.893Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 90 %
build   24-Jun-2024 17:57:08    2024-06-24T15:57:03.923Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : finished
build   24-Jun-2024 17:57:08    2024-06-24T15:57:04.798Z ERROR 209 --- [       Thread-5] d.f.e.m.s.autoconfigure.EmbeddedMongo    : /home/build-user/.embedmongo/fileSets/40fbf87d12e31eb507b18eda2d454841b3ab04132d659478f6179b8faaa509b9/mongod: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory

build   24-Jun-2024 17:57:08    Caused by: java.lang.RuntimeException: Could not start process: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
build   24-Jun-2024 17:57:08        at de.flapdoodle.embed.mongo.transitions.RunningMongoProcess.lambda$null$1(RunningMongoProcess.java:179) ~[de.flapdoodle.embed.mongo-4.11.1.jar:na]
build   24-Jun-2024 17:57:08        at de.flapdoodle.types.ThrowingSupplier.lambda$andFinally$1(ThrowingSupplier.java:47) ~[de.flapdoodle.java8-1.4.2.jar:na]
build   24-Jun-2024 17:57:08        at de.flapdoodle.types.ThrowingSupplier.lambda$andFinally$1(ThrowingSupplier.java:47) ~[de.flapdoodle.java8-1.4.2.jar:na]
build   24-Jun-2024 17:57:08        at de.flapdoodle.embed.mongo.transitions.RunningMongoProcess.lambda$factory$3(RunningMongoProcess.java:185) ~[de.flapdoodle.embed.mongo-4.11.1.jar:na]
build   24-Jun-2024 17:57:08        at de.flapdoodle.embed.process.types.RunningProcess.start(RunningProcess.java:83) ~[de.flapdoodle.embed.process-4.10.1.jar:na]
build   24-Jun-2024 17:57:08        at de.flapdoodle.embed.mongo.transitions.MongoServerStarter.result(MongoServerStarter.java:119) ~[de.flapdoodle.embed.mongo-4.11.1.jar:na]
build   24-Jun-2024 17:57:08        at de.flapdoodle.reverse.TransitionWalker.resolve(TransitionWalker.java:58) ~[de.flapdoodle.reverse-1.7.2.jar:na]
build   24-Jun-2024 17:57:08        at de.flapdoodle.reverse.TransitionWalker.resolve(TransitionWalker.java:46) ~[de.flapdoodle.reverse-1.7.2.jar:na]
build   24-Jun-2024 17:57:08        at de.flapdoodle.reverse.TransitionWalker.initState(TransitionWalker.java:180) ~[de.flapdoodle.reverse-1.7.2.jar:na]
michaelmosmann commented 3 months ago

@neottil if something fails, ubuntu is the fallback.. the libcrypto.so.1.1 error message is triggered by the fallback ubuntu version.. (the binary would run, but libcrypto 1.1 is missing, i guess there is a libcrypto 3.x)

you can override the os detection this way: https://github.com/flapdoodle-oss/de.flapdoodle.os?tab=readme-ov-file#run ..

The detection of Amazon Linux is partial based on just the hostname (see https://github.com/flapdoodle-oss/de.flapdoodle.os/blob/main/src/main/java/de/flapdoodle/os/linux/AmazonVersion.java) .. is this the case?

neottil commented 3 months ago

Thanks for the very quick response. By looking your link I see: "You can override platform detection with system property de.flapdoodle.os.override= where platform contains the os, architecture, distribution and version (optional)." But for oracle linux 9 what's the exact platform value? Linux|X86_64|Oracle|9 it's correct?

The dependency de.flapdoodle.embed.mongo.spring31x is sufficient or should I also use de.flapdoodle.os?

I've try to build project on container deployed on EKS, but I've not control of this. Maybe the hostname can contains amzn and its match with Amazon detection. It's possible detect version from os-release file? I think it is more reliable, or not?

michaelmosmann commented 3 months ago

@neottil it should be "Linux|X86_64|Oracle|Oracle_9" .. just the enum value from https://github.com/flapdoodle-oss/de.flapdoodle.os/blob/main/src/main/java/de/flapdoodle/os/linux/OracleVersion.java

The dependency de.flapdoodle.embed.mongo.spring31x is sufficient or should I also use de.flapdoodle.os?

the spring dependency is enough:)

Maybe the hostname can contains amzn and its match with Amazon detection.

This was the only way to detect if this could be an amazon linux .. so maybe i must change this to "if its amazon+ use ".

neottil commented 3 months ago

Hi, I added in my test application.properties file the property de.flapdoodle.os.override=Oracle_9 as suggested. The error during build persist. When mvn run tests the exception is thrown.

build   01-Jul-2024 09:49:27    2024-07-01T07:49:27.950Z  INFO 209 --- [           main] d.f.e.m.s.a.SyncClientServerFactory      : sync server factory
build   01-Jul-2024 09:49:28    2024-07-01T07:49:28.045Z  WARN 209 --- [           main] d.f.os.common.PeculiarityInspector       : more than one match: [Oracle, Amazon]
build   01-Jul-2024 09:49:28    2024-07-01T07:49:28.093Z  WARN 209 --- [           main] d.f.e.m.p.linux.LinuxPackageFinder       : because there is no package for GenericFeatureAwareVersion{6.0.6}:Platform{operatingSystem=Linux, architecture=X86_64} we fall back to GenericFeatureAwareVersion{6.0.6}:Platform{operatingSystem=Linux, architecture=X86_64, version=Ubuntu_20_04}
build   01-Jul-2024 09:49:28    2024-07-01T07:49:28.775Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : starting...
build   01-Jul-2024 09:49:28    2024-07-01T07:49:28.780Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 0 %
build   01-Jul-2024 09:49:28    2024-07-01T07:49:28.957Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 10 %
build   01-Jul-2024 09:49:29    2024-07-01T07:49:29.079Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 20 %
build   01-Jul-2024 09:49:29    2024-07-01T07:49:29.202Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 30 %
build   01-Jul-2024 09:49:29    2024-07-01T07:49:29.282Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 40 %
build   01-Jul-2024 09:49:29    2024-07-01T07:49:29.332Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 50 %
build   01-Jul-2024 09:49:29    2024-07-01T07:49:29.368Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 60 %
build   01-Jul-2024 09:49:29    2024-07-01T07:49:29.404Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 70 %
build   01-Jul-2024 09:49:29    2024-07-01T07:49:29.439Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 80 %
build   01-Jul-2024 09:49:29    2024-07-01T07:49:29.470Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : 90 %
build   01-Jul-2024 09:49:29    2024-07-01T07:49:29.499Z  INFO 209 --- [           main] d.f.e.m.s.autoconfigure.EmbeddedMongo    : download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.6.tgz : finished
build   01-Jul-2024 09:49:30    2024-07-01T07:49:30.277Z ERROR 209 --- [       Thread-4] d.f.e.m.s.autoconfigure.EmbeddedMongo    : /home/build-user/.embedmongo/fileSets/40fbf87d12e31eb507b18eda2d454841b3ab04132d659478f6179b8faaa509b9/mongod: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
build   01-Jul-2024 09:49:30    2024-07-01T07:49:30.361Z  WARN 209 --- [           main] o.s.w.c.s.GenericWebApplicationContext   : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mongoControllerImpl': Unsatisfied dependency expressed through field 'mongoQueryService': Error creating bean with name 'mongoQueryServiceImpl': Unsatisfied dependency expressed through field 'mongoTemplate': Error creating bean with name 'mongoTemplate' defined in class path resource [org/springframework/boot/autoconfigure/data/mongo/MongoDatabaseFactoryDependentConfiguration.class]: Unsatisfied dependency expressed through method 'mongoTemplate' parameter 0: Error creating bean with name 'mongoDatabaseFactory' defined in class path resource [org/springframework/boot/autoconfigure/data/mongo/MongoDatabaseFactoryConfiguration.class]: Unsatisfied dependency expressed through method 'mongoDatabaseFactory' parameter 0: Error creating bean with name 'syncClientServerWrapper' defined in class path resource [de/flapdoodle/embed/mongo/spring/autoconfigure/EmbeddedMongoAutoConfiguration$SyncClientServerWrapperConfig.class]: rollback after error on transition to State(RunningMongodProcess), successful reached:

The property has no effect; it still seems flapdoodle recognize two possible hosts. Any other suggestion?

Thank you.

michaelmosmann commented 3 months ago

@neottil .. sorry.. the property value should be: Linux|X86_64|Oracle|Oracle_9 ..

neottil commented 3 months ago

So sorry for my mistake in property evaluation. Also with de.flapdoodle.os.override=Linux|X86_64|Oracle|Oracle_9 the error dosn't change. it's reconized [Oracle, Amazon] and not forced Oracle.

michaelmosmann commented 3 months ago

@neottil .. ok, i will have to look into this soon..

michaelmosmann commented 3 months ago

@neottil there is a new release where the best match is used.. so i would close this issue.. reopen if there is still an issue.