简体   繁体   English

使用AWS SDK for Java API时SSLHandshakeException

[英]SSLHandshakeException while using AWS SDK for Java API

I'm using the Java API to upload and download files in Amazon S3. 我正在使用Java API在Amazon S3中上传和下载文件。 It was working perfectly until about a week ago, and it just stopped working altogether even though I hadn't touched the code. 直到大约一周前,它一直运行良好,即使我没有接触过代码,它也完全停止工作。 I'm wondering if there's a solution to this. 我想知道是否有解决方案。 Thanks! 谢谢!

Over here's the code that was worked fine: 上面的代码运行良好:

AWSCredentials credentials = new BasicAWSCredentials(ACCESSKEYID, SECRETKEY);
AmazonS3Client s3client = new AmazonS3Client(credentials);
List<String> bucketList = new ArrayList<String>();
    for (Bucket bucket : s3client.listBuckets()) {
        System.out.println(bucket.getName());
    }

And here's the error: 这是错误:

Apr 11, 2015 9:44:12 PM com.amazonaws.http.AmazonHttpClient executeHelper
INFO: Unable to execute HTTP request: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1904)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:279)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:273)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1446)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:209)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:901)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:837)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1023)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1359)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1343)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:534)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:402)
at com.amazonaws.http.conn.ssl.SdkTLSSocketFactory.connectSocket(SdkTLSSocketFactory.java:118)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:685)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:460)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:295)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3736)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3686)
at com.amazonaws.services.s3.AmazonS3Client.listBuckets(AmazonS3Client.java:688)
at com.amazonaws.services.s3.AmazonS3Client.listBuckets(AmazonS3Client.java:696)
at keymanager.service.AWSAPI.getBucketList(AWSAPI.java:130)
at keymanager.view.KeyManager.initializeBucketList(KeyManager.java:59)
at keymanager.view.KeyManager.connectButtonActionPerformed(KeyManager.java:626)
at keymanager.view.KeyManager.access$1000(KeyManager.java:22)
at keymanager.view.KeyManager$12.actionPerformed(KeyManager.java:425)

I'd done a bit of research, and some had suggested that the problem could be with the permissions. 我做了一些研究,有人建议问题可能出在权限上。 However, I think I've followed the instructions here: http://docs.aws.amazon.com/AWSToolkitEclipse/latest/GettingStartedGuide/tke_setup_creds.html#d0e387 as well as I could. 但是,我认为我已经按照这里的说明进行了操作: http : //docs.aws.amazon.com/AWSToolkitEclipse/latest/GettingStartedGuide/tke_setup_creds.html#d0e387 I'm really pretty stuck, guys. 伙计们,我真的很卡住。 Thanks, and any help at all will be appreciated! 谢谢,所有帮助将不胜感激!

I had same problem. 我有同样的问题。 The solution turned out to be the device wrong date. 解决方法原来是设备错误的日期。 Try to keep your device date updated. 尝试保持设备日期更新。 The reason is that SSL certificates have issuance/expiry date that are being verified against your device date. 原因是SSL证书具有签发/到期日期,正在针对您的设备日期进行验证。

I have encountered similar problem. 我遇到类似的问题。 My issue was I have marked the proxy configuration in the beans xml file as given below. 我的问题是我已在bean xml文件中标记了代理配置,如下所示。

<bean id="clientConfiguration" class="com.amazonaws.ClientConfiguration"> <property name="proxyHost" value="proxy.server.com"/> <property name="proxyPort" value="8080"/> </bean>

But forgot to set the property . 但是忘了设置财产。

Once entered the protocol it started working 输入协议后,它开始工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Dropbox Java SDK for API v2时获取SSLHandshakeException - Getting SSLHandshakeException when using Dropbox Java SDK for API v2 使用Java使用REST API-SSLHandshakeException - Consume REST API using java - SSLHandshakeException 使用 ResteasyClient 发送到 AWS API Gateway 的 SSLHandShakeException - SSLHandShakeException to AWS API Gateway with ResteasyClient 使用AWS SDK for java运行程序时出现NoClassDefFoundError - NoClassDefFoundError while running a program using AWS SDK for java AWS Api Gateway-Java SDK生成“生成SDK时发生内部错误” - AWS Api Gateway - Java SDK generation “Internal error occurred while generating SDK” 如何在使用 java aws sdk 创建 aws ec2 时提供实例名称 - How to provide name of the Instance while creating aws ec2 using java aws sdk AWS 配置使用 aws java sdk - AWS configure get using aws java sdk Java AWS开发工具包-如何使用Java API中的IAM配置文件上传文件 - Java AWS SDK - How to upload file using IAM profile from Java API 从Java代码连接到HTTPS时发生SSLHandshakeException - SSLHandshakeException while connecting to HTTPS from java code 尝试使用 AWS SDK 从 Java 应用程序连接 SQS 时出现 403 禁止错误 - 403 forbidden error while trying to connect SQS from Java application using AWS SDK
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM