2

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?

stivlo
  • 83,644
  • 31
  • 142
  • 199

1 Answers1

5

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.

Community
  • 1
  • 1
stivlo
  • 83,644
  • 31
  • 142
  • 199
  • Hi! Self-answers are not a bad thing, here on SO self-answering questions you already solved is good practice and helps other people who find your question when they search for a solution for their problem! – BertNase Aug 05 '11 at 09:20
  • I'm facing the same issue while accessing was documentDB using java sdk. However, I am doing a simple read operation to using AWS lambda. loading cert is the problem – Sumanth Varada Jul 26 '19 at 18:19