最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

spring boot - Java JAR Runs in Docker Desktop but Fails on Linux (Same Image & Identical JARs) - Stack Overflow

programmeradmin5浏览0评论

I'm running a Java application inside a Maven-based Docker image. When I run the container on Docker Desktop, I can:

  1. Enter the container

  2. Build a JAR using Maven (mvn package)

  3. Run the JAR successfully with java -jar myapp.jar

However, when I run the same Docker image on a Linux machine, I follow the exact same steps, but the JAR fails to run with the error:

Error creating bean with name 'someName' defined in URL [jar:nested:/app/target/kafka.jar/!BOOT-INF/classes/!/aggregations/processors/someName.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'someName2' defined in class path [/springframework/kafka/annotations/someName2.class]: Failed to instantiate [.springframework.kafka.config.someName2]: Factory method 'defaultKafkaStreamsBuilder' threw exception with message: null

What I've Checked So Far: The image is identical (same image ID in docker image ls).

The architecture is the same (uname -m inside the container returns x86_64 in both environments).

Java versions are identical (java -version shows the same JDK version).

The JARs are completely identical (jar tvf myapp.jar shows the same files and structure).

Maven versions are the same (mvn -version is identical).

File permissions are the same (ls -l myapp.jar confirms normal permissions).

Strange Discovery: If I build the JAR inside Docker Desktop, copy it to the Linux container, and run it → it works.

If I build the JAR inside the Linux container and try to run it → it fails.

What could cause a JAR file built inside the Linux container to fail while the same JAR, built inside Docker Desktop, works?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论