'Getting instance of ("Windows-MY") from KeyStore returns null

I have a peculiar observation while attempting to utilize KeyStore. Below is my code.

 public void initialize(String password) throws Exception 
 {
  try{

 keyStorePassword = password;
 try{
  keyStore = KeyStore.getInstance("Windows-MY");
  if(keyStore == null)
    {
    logger.info("KeyStore is null");
    }
 
  }
}

In the development environment, this code is working and the keyStore value is not returning null. However when I am trying the same code on a UAT environment, the keystore is returning null. Could I be missing out on any mandatory environment variable settings in the UAT environment? I referred the documentation and found that Security.getProviders() provides list of registered providers. However the issue I am facing seems to be environment specific. Any support will be really appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source