Closed
Description
Problem:
VersionInfo#loadUserAgent tries to load a version from a file, this fails catastrophically when this library is packed with the spring-boot-maven-plugin: the result of ClassLoader.getSystemResourceAsStream("project.properties")
is null, triggering a NullPointerException which is not handled, which results in the following error for me.
java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.encryptionsdk.kms.KmsMasterKey
Works fine directly (IntelliJ run), but debugging the app within my docker-build clearly shows the issue:
application.jar packed with
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.2</version> <!-- EDIT: also tested latest = 2.5.1 -->
</plugin>
Solution(s):
- Handle a null resource stream, and/or catch NullPointerExceptions here as well as IOExceptions.
- Or simply hard-code the version directly in this file rather than delegating to a properties resource?
- Use a classLoader from the same jar, e.g., the following works in my debugger:
properties.load(VersionInfo.class.getClassLoader().getResourceAsStream("project.properties"));
Metadata
Metadata
Assignees
Labels
No labels