首页 > 代码库 > keytool error: java.lang.Exception: Certificate not imported, alias already exists

keytool error: java.lang.Exception: Certificate not imported, alias already exists

Error 

Command to import the certificate into the Java keystore fails with the following error:

keytool error: java.lang.Exception: Certificate not imported, alias already exists

Cause 

Alias already exist. Needs to removed previous alias before adding a new one. 

Resolution 

Make sure that you don‘t require the previous import with the same alias. If required , Do this import with new alias. If not, proceed with the following command. 

Delete the certificate with the alias using the following command 

keytool -delete -alias <Key> -keystore <../.../... /lib/security/cacerts> -storepass changeit . 

Then run the import command.

keytool error: java.lang.Exception: Certificate not imported, alias already exists