I have a webservice Java loaded in AWS Elastic Beanstalk. This webservice make SSL rest call using jks keystore. When I execute the webservice on my machine, I load keystore with
System.setProperty("javax.net.ssl.trustStore", "c:\...\file.jks");
System.setProperty("javax.net.ssl.trustStorePassword", "password");
System.setProperty("javax.net.ssl.keyStore", "c:\...\file.jks");
System.setProperty("javax.net.ssl.keyStorePassword", "sviluppo");
With System.setProperty I need absolute path of file.jks. How Can I make the same on AWS Elastic Beanstalk?
(I tried with getAbsolutePath() and getCanonicalPath() but, on my machine, these istructions return myEclipse root)
Thanks for your answer. I solve it in this way: first I put my jks file in a project package "package" with client "Test". Inside my code I wrote:
String pathKeyStore = package.Test.class.getResource("file.jks").getPath();
pathKeyStore = pathResourceKeyStore.replaceAll("%20", " ");
System.setProperty("javax.net.ssl.trustStore", pathKeyStore);
System.setProperty("javax.net.ssl.trustStorePassword", "password");
System.setProperty("javax.net.ssl.keyStore", pathKeyStore);
System.setProperty("javax.net.ssl.keyStorePassword", "password");
And it works also in AWS Elastic Beanstalk!