File path cacerts for javax.net.ssl.trustStore does not work on . War

Asked

Viewed 219 times

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);

Running the project through IDE STS(Spring boot) works, but when generating the file. War and run it from error as it does not find the path to the cacerts file, as I can set the file to work with . WAR ?

I also tried to remove System.setProperty and set cacerts when running java-jar but it didn’t work either:

java -Djavax.net.ssl.trustStore=./cacerts -jar target/uaa-0.0.1-SNAPSHOT.war
  • please add the errors generated by each run

1 answer

0

Without the stack trace it is difficult to give an assertive answer, but we will test 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);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.