Amazon SimpleDB: KeyStoreException problem accessing trust store
All in a sudden my Java application using SimpleDB doesn't work anymore. I'm using Java AWS SDK version 1.2.4 on Windows 7. I've the following exception:
java.security.KeyStoreException: problem accessing trust storejava.io.IOException: Invalid keystore开发者_运维知识库 format
com.sun.net.ssl.internal.ssl.TrustManagerFactoryImpl.engineInit(TrustManagerFactoryImpl.java:55)
javax.net.ssl.TrustManagerFactory.init(TrustManagerFactory.java:230)
org.apache.http.conn.ssl.SSLSocketFactory.createSSLContext(SSLSocketFactory.java:190)
org.apache.http.conn.ssl.SSLSocketFactory.createDefaultSSLContext(SSLSocketFactory.java:209)
org.apache.http.conn.ssl.SSLSocketFactory.<init>(SSLSocketFactory.java:333)
org.apache.http.conn.ssl.SSLSocketFactory.getSocketFactory(SSLSocketFactory.java:165)
org.apache.http.impl.conn.SchemeRegistryFactory.createDefault(SchemeRegistryFactory.java:45)
org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.<init>(ThreadSafeClientConnManager.java:98)
com.amazonaws.http.HttpClientFactory.createHttpClient(HttpClientFactory.java:67)
com.amazonaws.http.AmazonHttpClient.<init>(AmazonHttpClient.java:111)
com.amazonaws.AmazonWebServiceClient.<init>(AmazonWebServiceClient.java:59)
com.amazonaws.services.simpledb.AmazonSimpleDBClient.<init>(AmazonSimpleDBClient.java:118)
What could the cause be and how to solve the problem?
Sorry for self answer, but I solved the problem. It was caused by my certificate file, pointed by these statements loaded by a ServletContextListener defined in my web.xml
String sslCertPath = contextEvent.getServletContext().getRealPath(
"/WEB-INF/classes/jssecacerts");
System.setProperty("javax.net.ssl.trustStore", sslCertPath);
Commenting out those lines everything works. This is caused by a corruption of that file.
After that, I fixed my key store, uncommented the lines, had a little fight with tomcat and after that everything was working again, also with my certificates in place.
精彩评论