Amazon SimpleDB:访问信任库的KeyStoreException问题

时间:2011-08-05 08:21:46

标签: java amazon-simpledb

突然之间,使用SimpleDB的Java应用程序不再起作用了。我在Windows 7上使用Java AWS SDK 1.2.4版。我有以下例外:

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)

原因是什么以及如何解决问题?

1 个答案:

答案 0 :(得分:1)

很抱歉自己回答,但我解决了这个问题。它是由我的证书文件引起的,由我的web.xml中定义的ServletContextListener加载的这些语句指向

 String sslCertPath = contextEvent.getServletContext().getRealPath(
   "/WEB-INF/classes/jssecacerts");
 System.setProperty("javax.net.ssl.trustStore", sslCertPath);

评论这些线条一切正常。这是由于该文件损坏引起的。

之后,我修复了我的密钥库,取消注释了这些行,有一个little fight with tomcat,之后一切都恢复了,还有我的证书。