I have a Springboot all in which the application YAML has this entry for SSL. I generated the pfx certificate via openssl command on the EC2 and copied it to resources folder of Springboot app. I had pressed when prompted for the Keystore password while the PFX certificate generation (so, nothing set for the keystore password).
The app runs fine when deployed as a Jar and handles all HTTPS calls.
server:
port: 9090
ssl:
key-store: classpath:certificate-prod.pfx
key-store-password:
key-store-type: PKCS12
However, when I doing a Docker Compose (locally/ Windows), the inbuilt tomcat container throws this error and the docker container stops.
Caused by: java.io.IOException: keystore password was incorrect vtx_api_app | at java.base/sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:2117) ~[na:na] vtx_api_app | at java.base/sun.security.util.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:222) ~[na:na] vtx_api_app | at java.base/java.security.KeyStore.load(KeyStore.java:1479) ~[na:na] vtx_api_app | at org.apache.tomcat.util.security.KeyStoreUtil.load(KeyStoreUtil.java:67) ~[tomcat-embed-core-9.0.46.jar!/:na]
I am using JDK 11. This is my Dockerfile:
FROM adoptopenjdk:11
COPY target/analytics-api.jar analytics-api.jar
ENTRYPOINT ["sh", "-c","java -jar -Dspring.profiles.active=prod analytics-api.jar"]
Any idea whats causing this and any pointers to resolve this?