Skip to content

[BUG] ModelMapper cannot register any resource classes if packaged in executable fat jar #1659

@yue9944882

Description

@yue9944882

Describe the bug

if the project is packaged in a whole executable fat jar, e.g:

$ jar -tf my-project-executable.jar
META-INF/
META-INF/MANIFEST.MF
org/
org/springframework/
org/springframework/boot/
...
BOOT-INF/lib/gson-fire-1.8.5.jar
BOOT-INF/lib/joda-time-2.10.5.jar
BOOT-INF/lib/joda-convert-2.2.1.jar
BOOT-INF/lib/client-java-proto-11.0.1.jar
BOOT-INF/lib/client-java-11.0.1.jar  # NESTED JAR FILE
...

the classes under io.kubernetes.client.openapi.model will be packaged as a nested jar file inside the fat jar file. when we're trying scanning the classes via the class-loader. the URL for the pre-built resource classes will be e.g.:

file:/home/admin/release/run/target/boot/agent-installer-bootstrap-0.0.1-SNAPSHOT-executable.jar!/BOOT-INF/lib/client-java-api-11.0.1.jar!/io/kubernetes/client/openapi/models

then we will get a wrong URL to the jar file when we're extracting file path from the resource path above:

/home/admin/release/run/target/boot/agent-installer-bootstrap-0.0.1-SNAPSHOT-executable.jar!/BOOT-INF/lib/client-java-api-11.0.1.jar

b/c we cant correctly open the actual jar file using the file path above, no classes will be found in the end.. one feasible solution i can think of is to visit the nested jar file recursively if multiple ! is found in the URL.

** Client Version **
e.g. `11.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions