Why the system properties are not being set programmatically?
When I say does not take affect it happens only when we do things in a
certain order.
For example we need to connect to URL_CACERTS and URL_KS. URL_KS connection
needs the keystore properties. For URL_CACERTS we just imported their public
key to cacerts.
Case 1: If we connect to URL_CACERTS first and then to URL_KS, connection to
URL_KS is not successful. Somehow the setting keystore properties does not take
affect. We have the following lines of code before doing the HttpURLConnection:
System.setProperty(javax.net.ssl.keyStorePassword, _storePwd);
System.setProperty(javax.net.ssl.keyStore, _keystorePath);
Case 2: If we connect to URL_KS first, and then URL_CACERTS, this sequence
always works, somehow the keystore properties are set for the entire length.
So to overcome this conflict, we added the properties to the tomcat service:
If we start the tomcat service(or adding to catalina.bat) with the following
parameters:
-Djavax.net.ssl.keyStorePassword=changeit
-Djavax.net.ssl.keyStore=C:\certificates\pntKS
These system properties setting takes affect, and order of conneting to
URL_CACERTS or URL_KS does not matter.
My question in how is connecting to URL_CACERTS first affecting the keystore
properties?
Without the above and doing the following only, its dependent on the order of
connection. why?
when we do the same thing by doing this it does not take affect
System.setProperty(javax.net.ssl.keyStorePassword, _storePwd);
System.setProperty(javax.net.ssl.keyStore, _keystorePath);
Connecting to URL_CACERTS does not have any special code, we do plain
HttpURLConnection and write and read from the http connection.
What is happening behind the scene? Why does order matter?
Thanks for reading.
Rumpa Giri
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com