Cacerts file path to javax.net.ssl.trustStore does not work in .war

1

I need to set the path of a cacerts file to the trustStore, to do this I did:

String keystore = "src/main/resources/cacerts";
System.setProperty("javax.net.ssl.trustStore", keystore);

When running the project through the STS IDE (Spring boot) it works, but when generating the .war file and executing it from the error because it does not find the path to the cacerts file, how can I set the file to work with .WAR ?

I also tried to remove System.setProperty and set cacerts to run java -jar but it did not work either:

java -Djavax.net.ssl.trustStore=./cacerts -jar target/uaa-0.0.1-SNAPSHOT.war
    
asked by anonymous 10.10.2018 / 22:44

1 answer

0

Without the trace stack it is difficult to give an assertive answer, but let's try a possible solution.

Try adding the cacerts path to a property in the application.properties file, for example:

minha.propriedade.caceerts = src/main/resources/cacerts

Then to use the property:

@Value("${minha.propriedade.caceerts}")
private String keystore;
System.setProperty("javax.net.ssl.trustStore", keystore);
    
10.11.2018 / 18:35