java.io.IOException: Invalid Keystore format java.io.IOException: Invalid Keystore format java java

java.io.IOException: Invalid Keystore format


You may corrupt the file during copy/transfer.

Are you using maven?If you are copying keystore file with "filter=true", you may corrupt the file.

Please check the file size.


Maybe maven encoding you KeyStore, you can set filtering=false to fix this problem.

<build>    ...    <resources>        <resource>            ...            <!-- set filtering=false to fix -->            <filtering>false</filtering>            ...        </resource>    </resources></build>


(Re)installing the latest JDK (e.g. Oracle's) fixed it for me.

Prior to installing the latest JDK, when I executed the following command in Terminal.app:

keytool -list -keystore $(/usr/libexec/java_home)/jre/lib/security/cacerts -v

It resulted in:

keytool error: java.io.IOException: Invalid keystore formatjava.io.IOException: Invalid keystore format    at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:650)    at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:55)    at java.security.KeyStore.load(KeyStore.java:1445)    at sun.security.tools.keytool.Main.doCommands(Main.java:792)    at sun.security.tools.keytool.Main.run(Main.java:340)    at sun.security.tools.keytool.Main.main(Main.java:333)

But, after installing the latest Oracle JDK and restarting Terminal, executing the following command:

keytool -list -keystore $(/usr/libexec/java_home)/jre/lib/security/cacerts -v

Results in:

Enter keystore password:  

Which indicates that the keytool on path can access the keystore.