I have a class that accesses a web service through HTTPS. This class will be used by a separate application. While developing the class I created JUnittest cases for testing. These test cases invoke a connection method in the class which connects to the web service.
The web service documentation indicates that the trusted certificate for the server should be imported into a java keystore at a specific location/directory as other tools will expect it to be there.
Since this is not what I think of as the standard place for certs, cacerts, I added the following code to my class to point to the appropriate location:
When I added the class to the application, I received an error about not being able to find the certificate.
I contacted the developer for the application that will use my class and they said that I needed to add the certificate to the cacerts keystore.
Now the application works as well.
My question is this. Why do I need to add the certificate to cacerts if my class code sets system properties so that the certificate can be found before attempting to connect? Does the application somehow override my code for the certificate?
While everything is working fine, I would like to understand how this works.
Thanks in advance
Joined: Aug 02, 2012
Wow, is there anyone here that can explain this to me?