IllegalArgumentException Reported When Compiling Spring Boot
Symptom
During the test case execution, "IllegalArgumentException: this version does not support 32Bit" is displayed.
Key Process and Cause Analysis
During the compilation, the third-party dependency packages de.flapdoodle.embed.process-2.1.2.jar and de.flapdoodle.embed.mongo-2.2.0.jar do not support the Arm64 architecture. Download and build the mongo and process JAR packages that support the Arm64 architecture.
Conclusion and Solution
- Download and build the mongo and process JAR packages that support the Arm64 architecture.
wget https://mirrors.huaweicloud.com/kunpeng/maven/de/flapdoodle/embed/de.flapdoodle.embed.mongo/2.2.0/de.flapdoodle.embed.mongo-2.2.0.jar wget https://mirrors.huaweicloud.com/kunpeng/maven/de/flapdoodle/embed/de.flapdoodle.embed.process/2.1.2/de.flapdoodle.embed.process-2.1.2.jar
- Create a library directory if it does not exist.
mkdir -p /root/.m2/repository/de/flapdoodle/embed/de.flapdoodle.embed.mongo/2.2.0 mkdir -p /root/.m2/repository/de/flapdoodle/embed/de.flapdoodle.embed.process/2.1.2
- Move the downloaded JAR package to the corresponding directories.
\cp de.flapdoodle.embed.mongo-2.2.0.jar /root/.m2/repository/de/flapdoodle/embed/de.flapdoodle.embed.mongo/2.2.0 \cp de.flapdoodle.embed.process-2.1.2.jar /root/.m2/repository/de/flapdoodle/embed/de.flapdoodle.embed.process/2.1.2
- This document uses MongoDB 4.0.12 as an example to describe how to replace other versions used in the test cases.
cd spring-boot-project/spring-boot-autoconfigure sed -i "s/3\.5\.5/4\.0\.12/g" `grep -rl "3\.5\.5"` sed -i "s/3\.4\.1/4\.0\.12/g" `grep -rl "3\.4\.1"` sed -i "s/3_4_15/4_0_12/g" `grep -rl "3_4_15"` cd ../../
- Create a /root/.embedmongo/extracted/Linux-B64--4.0.12 directory.
mkdir -p /root/.embedmongo/extracted/Linux-B64--4.0.12
- Compile MongoDB by referring to MongoDB 4.0.12 Porting Guide.
- Replace the MongoDB in the local repository with the compiled one.
\cp /usr/local/mongo/bin/mongod /root/.embedmongo/extracted/Linux-B64--4.0.12 && mv /root/.embedmongo/extracted/Linux-B64--4.0.12/mongod /root/.embedmongo/extracted/Linux-B64--4.0.12/extractmongod
- For MongoDB 4.0 or later versions, after replsetName is set, NoJournal must be set to false. In addition, you need to modify the EmbeddedMongoAutoConfiguration.java file.
- Modify the EmbeddedMongoAutoConfiguration.java source code.
vim ./spring-boot-project/spring-boot-autoconfigure//src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java
- Press i to enter the insert mode and add the following content to the file:
- Add the following content below line 32:
import de.flapdoodle.embed.mongo.config.MongoCmdOptionsBuilder;

- Add the following content below line 133:
if (replSetName != null) { MongoCmdOptionsBuilder optionsBuilder = new MongoCmdOptionsBuilder(); optionsBuilder.useNoJournal(false); builder.cmdOptions(optionsBuilder.build()); }
Run the :set list command to check the format. Spaces are not allowed. Use Tab to indent the code.
- Add the following content below line 32:
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Modify the EmbeddedMongoAutoConfiguration.java source code.
Parent topic: Troubleshooting
