Tomcat and SSL: invalid keystore format
I'm having the following problem when starting Tomcat 6:
[INFO] [talledLocalContainer] Caused by: java.io.IOException: Invalid keystore format
[INFO] [talledLocalContainer] at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:633)
[INFO] [talledLocalContainer] at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:38)
[INFO] [talledLocalContainer] at java.security.KeyStore.load(KeyStore.java:1185)
[INFO] [talledLocalContainer] at org.springframework.ws.soap.security.support.KeyStoreFactoryBean.afterPropertiesSet(KeyStoreFactoryBean.java:123)
I have configured the KeyStoreFactoryBean to load a keystore in my classpath, which I made myself using java 1.6.0_05.
The weird thing is, when I start the same Tomcat using Eclipse the keystore gets loaded without any problems. If I start the Tomcat using the Cargo Maven plugin, I get this exception. If I install the application in a freshly downloaded Tomcat 6 I get the excetpion. And unfortunately I get the same exception when deploying the application on our unix environments.
The only jdk versions I have installed are 1.6.0_05 and 1.6.0开发者_StackOverflow_23, however I've tried with both versions and it doesn't seem to make difference. I've also tried it on a different machine with only 1.6.0_05, didn't work either. A colleague who uses the same keystore in his applications has no problems whatsoever, and his Spring configuration is exactly the same (don't think the problem lies there though).
When looking in the source of JavaKeyStore (source code) you can see it checks the first two ints it reads from the keystore to check it's format and throw the exception. I can't image what difference in starting Tomcat using Eclipse may cause this piece of code to execute otherwise and not throw the exception.
Googling didn't help me either, lots of people seem to get this exception, but usually because they made the keystore with an older version of the jdk.
Edit: the provider is "SUN version 1.6" and type is JKS. This the same for both cases, working and not-working.
Solved: the maven build filtered the certificate (using the resources plugin) and somehow changed the keystore. Excluding the keystore from the resources plugin solved it.
精彩评论