对象存储oss使用问题之使用oss上服务器后显示服务异常如何解决

本文涉及的产品
对象存储 OSS,20GB 3个月
对象存储 OSS,恶意文件检测 1000次 1年
对象存储 OSS,内容安全 1000次 1年
简介: 《对象存储OSS操作报错合集》精选了用户在使用阿里云对象存储服务(OSS)过程中出现的各种常见及疑难报错情况,包括但不限于权限问题、上传下载异常、Bucket配置错误、网络连接问题、跨域资源共享(CORS)设定错误、数据一致性问题以及API调用失败等场景。为用户降低故障排查时间,确保OSS服务的稳定运行与高效利用。

问题一:osssdk调用EOS上传文件报错:返回结果无效,无法解析。


我使用的是osssdk,调用EOS。具体可以看这个文档:

https://help.aliyun.com/document_detail/2412601.html?spm=a2c4g.2412601.0.0.686e4484udqsaZ

sdk的版本是:

<dependency>
            <groupId>com.aliyun.oss</groupId>
            <artifactId>aliyun-sdk-oss</artifactId>
            <version>3.11.3</version>
        </dependency>

我确保的ak没有问题,使用的代码是文档提供的上传代码。

上传的时候就会报如下错误:

我尝试调用listObject或者listBucket都是没有问题的,单单就是上传putObject有问题。


参考回答:

根据你提供的错误信息,看起来是你的SDK版本与你的OSSSDK不兼容。你正在使用的AKS版本(1.0.17)与你的OSS SDK版本(3.11.3)不兼容。

解决这个问题的方法是,确保你的AKS版本与你的OSS SDK版本兼容。你可以查看OSS SDK的兼容性列表,看看哪个AKS版本与你的OSS SDK版本兼容。

另外,你也可以尝试更新你的AKS版本。你可以访问阿里云的OSS SDK页面,查看最新的AKS版本和兼容性信息。


关于本问题的更多回答可点击原文查看:https://developer.aliyun.com/ask/559121


问题二:想问一下,从阿里OSS流式下载的PDF文件,无法被pdfbox读取。想问下这种应该怎么解决呢?


GetObjectRequest getObjectRequest = new GetObjectRequest(bucketName, key);

// 获取OSSObject实例

OssObject ossObject = client.getObject(getObjectRequest);

// 获取输入流

InputStream inputStream = ossObject.getObjectContent();

// 使用输入流进行后续操作,比如读取PDF文件等

PDDocument load = PDDocument.load(inputStream);

最后一行报错,显示Error: End-of-File, expected line


参考回答:

"End-of-File, expected line" 错误通常表示 PDF 文件格式不正确或被截断了,导致 PDFBox 无法正确解析文件。这可能是由于多种原因引起的,包括网络传输问题、OSS 服务问题或 PDF 文件本身的问题。

最重要的是排除文件和网络传输问题。如果确定问题不是由于这些因素引起的,那么可以考虑尝试不同的 PDF 处理库


关于本问题的更多回答可点击原文查看:https://developer.aliyun.com/ask/553272


问题三:您好我使用阿里云oss上服务器后报错


本地使用的是http前缀 服务器是https 然后上传文件报错

请问这个怎么解决呢 ?


参考回答:

SSL异常通常是指在网络通信过程中出现的与SSL(安全套接层)相关的错误。服务器使用的是HTTPS,但是在OSS客户端配置中指定了HTTP URL。这可能导致客户端无法验证OSS服务器的身份,从而引发错误。请确保在客户端配置中使用正确的HTTPS URL。

您可以尝试以下方法:

检查服务器和客户端的SSL配置,确保使用了有效的证书和证书链。

检查网络环境,确保客户端和服务器之间的连接畅通无阻。

更新客户端的SSL库和驱动程序,以修复潜在的安全漏洞。

在客户端和服务器上启用日志记录,以便分析和定位具体的问题。

如果怀疑遭受了中间人攻击,可以使用SSL诊断工具(如OpenSSL的s_client命令行工具)来检查连接是否安全。


关于本问题的更多回答可点击原文查看:https://developer.aliyun.com/ask/549439


问题四:通过阿里云的域名打开的网页报这个错误,打不开页面,但是通过iss部署可以打开,这是为什么,怎么解决



参考回答:

1、检查下文件是否已经上传到OSS

2、检查是否接入CDN,如果有的话,需要将CDN的地址做DNS解析,如果没有的话参考第三点

3、检查DNS是否解析到OSS


关于本问题的更多回答可点击原文查看:https://developer.aliyun.com/ask/531613


问题五:紧急问题求助,生产环境都OK的,在另外一个客户现场报错了,提示SSL证书问题,连接超时?


SDK版本:3.16.3 JDK:OpenJDK1.8 异常信息: [ErrorCode]: SslException [RequestId]: Unknown

Connecting socket to msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com/106.14.228.109:443 with timeout 50000

Code: public static void main(String[] args) throws IOException { AliyunOSSUtils utils = new AliyunOSSUtils(); OSS oss = utils.init(); String path = utils.uploadPath(oss, "C:\home\issue_1686049594643.xlsx", "issue_1686049594643.xlsx", "ISSUE"); System.out.println(path); utils.destroy(oss); }

/**
 * 初始化构建客户端
 */
public OSS init() {
    return new OSSClientBuilder().build("***", "***", "***");
}
/**
 * 销毁客户端
 */
public void destroy(OSS client) {
    if (null != client) {
        client.shutdown();
    }
}
/**
 * 文件上传
 * @param client
 * @param filePath
 * @param businessModel
 * @return
 * @throws IOException
 */
public String uploadPath(OSS client, String filePath, String fileName, String businessModel) throws IOException {
    String path = new StringBuilder(businessModel)
            .append("/")
            .append(fileName).toString();
    PutObjectRequest putObjectRequest = new PutObjectRequest("**", path, new File(filePath));
    client.putObject(putObjectRequest);
    return path;
}

错误日志明细: 17:49:49.617 [main] DEBUG com.aliyun.oss - Loading mime types from file in the classpath: oss.mime.types 17:49:49.655 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default 17:49:49.662 [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context 17:49:49.663 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443][total available: 0; route allocated: 0 of 1024; total allocated: 0 of 1024] 17:49:49.672 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443][total available: 0; route allocated: 1 of 1024; total allocated: 1 of 1024] 17:49:49.673 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443 17:49:49.747 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com/106.14.228.109:443 17:49:49.747 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Connecting socket to msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com/106.14.228.109:443 with timeout 50000 17:49:49.817 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2] 17:49:49.818 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_EMPTY_RENEGOTIATION_INFO_SCSV] 17:49:49.818 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Starting handshake 17:49:50.224 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-0: Shutdown connection 17:49:50.225 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection discarded 17:49:50.225 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 0][route: {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443][total available: 0; route allocated: 0 of 1024; total allocated: 0 of 1024] 17:49:50.225 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Cancelling request execution 17:49:50.225 [main] WARN com.aliyun.oss - [Client]Unable to execute HTTP request: java.security.cert.CertificateException: None of the TrustManagers trust this certificate chain [ErrorCode]: SslException [RequestId]: Unknown 17:49:50.225 [main] DEBUG com.aliyun.oss - Retrying on com.aliyun.oss.ClientException: java.security.cert.CertificateException: None of the TrustManagers trust this certificate chain [ErrorCode]: SslException [RequestId]: Unknown 17:49:50.225 [main] DEBUG com.aliyun.oss - An retriable error request will be retried after 600(ms) with attempt times: 1 17:49:50.832 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default 17:49:50.832 [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context 17:49:50.832 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443][total available: 0; route allocated: 0 of 1024; total allocated: 0 of 1024] 17:49:50.832 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 1][route: {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443][total available: 0; route allocated: 1 of 1024; total allocated: 1 of 1024] 17:49:50.832 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443 17:49:50.833 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com/106.14.228.109:443 17:49:50.833 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Connecting socket to msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com/106.14.228.109:443 with timeout 50000 17:49:51.933 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2] 17:49:51.933 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_EMPTY_RENEGOTIATION_INFO_SCSV] 17:49:51.933 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Starting handshake 17:49:52.205 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-1: Shutdown connection 17:49:52.205 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection discarded 17:49:52.206 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 1][route: {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443][total available: 0; route allocated: 0 of 1024; total allocated: 0 of 1024] 17:49:52.206 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Cancelling request execution 17:49:52.206 [main] WARN com.aliyun.oss - [Client]Unable to execute HTTP request: java.security.cert.CertificateException: None of the TrustManagers trust this certificate chain [ErrorCode]: SslException [RequestId]: Unknown 17:49:52.206 [main] DEBUG com.aliyun.oss - Retrying on com.aliyun.oss.ClientException: java.security.cert.CertificateException: None of the TrustManagers trust this certificate chain [ErrorCode]: SslException [RequestId]: Unknown 17:49:52.206 [main] DEBUG com.aliyun.oss - An retriable error request will be retried after 1200(ms) with attempt times: 2 17:49:53.415 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default 17:49:53.416 [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context 17:49:53.416 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443][total available: 0; route allocated: 0 of 1024; total allocated: 0 of 1024] 17:49:53.416 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 2][route: {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443][total available: 0; route allocated: 1 of 1024; total allocated: 1 of 1024] 17:49:53.416 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443 17:49:53.416 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com/106.14.228.109:443 17:49:53.416 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Connecting socket to msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com/106.14.228.109:443 with timeout 50000 17:49:54.459 [idle_connection_reaper] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Closing expired connections 17:49:54.459 [idle_connection_reaper] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Closing connections idle longer than 60000 MILLISECONDS 17:49:54.473 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2] 17:49:54.473 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_EMPTY_RENEGOTIATION_INFO_SCSV] 17:49:54.473 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Starting handshake 17:49:56.638 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-2: Shutdown connection 17:49:56.638 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection discarded 17:49:56.639 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 2][route: {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443][total available: 0; route allocated: 0 of 1024; total allocated: 0 of 1024] 17:49:56.639 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Cancelling request execution 17:49:56.639 [main] WARN com.aliyun.oss - [Client]Unable to execute HTTP request: java.security.cert.CertificateException: None of the TrustManagers trust this certificate chain [ErrorCode]: SslException [RequestId]: Unknown 17:49:56.639 [main] DEBUG com.aliyun.oss - Retrying on com.aliyun.oss.ClientException: java.security.cert.CertificateException: None of the TrustManagers trust this certificate chain [ErrorCode]: SslException [RequestId]: Unknown 17:49:56.639 [main] DEBUG com.aliyun.oss - An retriable error request will be retried after 2400(ms) with attempt times: 3 17:49:59.053 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default 17:49:59.053 [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context 17:49:59.053 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443][total available: 0; route allocated: 0 of 1024; total allocated: 0 of 1024] 17:49:59.053 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 3][route: {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443][total available: 0; route allocated: 1 of 1024; total allocated: 1 of 1024] 17:49:59.053 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443 17:49:59.054 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com/106.14.228.109:443 17:49:59.054 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Connecting socket to msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com/106.14.228.109:443 with timeout 50000 17:49:59.118 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2] 17:49:59.118 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_EMPTY_RENEGOTIATION_INFO_SCSV] 17:49:59.118 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Starting handshake 17:49:59.410 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-3: Shutdown connection 17:49:59.410 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection discarded 17:49:59.410 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 3][route: {s}->https://msdai-dspot-prod.oss-cn-shanghai.aliyuncs.com:443][total available: 0; route allocated: 0 of 1024; total allocated: 0 of 1024] 17:49:59.410 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Cancelling request execution 17:49:59.410 [main] WARN com.aliyun.oss - [Client]Unable to execute HTTP request: java.security.cert.CertificateException: None of the TrustManagers trust this certificate chain [ErrorCode]: SslException [RequestId]: Unknown Exception in thread "main" com.aliyun.oss.ClientException: java.security.cert.CertificateException: None of the TrustManagers trust this certificate chain [ErrorCode]: SslException [RequestId]: Unknown at com.aliyun.oss.common.utils.ExceptionFactory.createNetworkException(ExceptionFactory.java:74) at com.aliyun.oss.common.comm.DefaultServiceClient.sendRequestCore(DefaultServiceClient.java:142) at com.aliyun.oss.common.comm.ServiceClient.sendRequestImpl(ServiceClient.java:149) at com.aliyun.oss.common.comm.ServiceClient.sendRequest(ServiceClient.java:85) at com.aliyun.oss.internal.OSSOperation.send(OSSOperation.java:134) at com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:192) at com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:153) at com.aliyun.oss.internal.OSSObjectOperation.writeObjectInternal(OSSObjectOperation.java:1195) at com.aliyun.oss.internal.OSSObjectOperation.putObject(OSSObjectOperation.java:130) at com.aliyun.oss.OSSClient.putObject(OSSClient.java:619) at com.oss.AliyunOSSUtils.uploadPath(AliyunOSSUtils.java:98) at com.oss.AliyunOSSUtils.main(AliyunOSSUtils.java:34) Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: None of the TrustManagers trust this certificate chain at sun.security.ssl.Alerts.getSSLException(Alerts.java:198) at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1967) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:331) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:325) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1688) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:226) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1082) at sun.security.ssl.Handshaker.process_record(Handshaker.java:1010) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1079) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1388) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1416) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1400) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:436) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:384) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) at com.aliyun.oss.common.comm.DefaultServiceClient.sendRequestCore(DefaultServiceClient.java:139) ... 10 more Caused by: java.security.cert.CertificateException: None of the TrustManagers trust this certificate chain at com.aliyun.oss.common.comm.DefaultServiceClient$CompositeX509TrustManager.checkServerTrusted(DefaultServiceClient.java:393) at sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLContextImpl.java:1099) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1670) ... 28 more


参考回答:

这个问题可能是由于您的代码与阿里云OSS存储系统的SSL证书不匹配所导致的。您可以尝试更新您的SDK版本或使用更新的JDK来解决这个问题。同时,您也可以尝试手动安装正确的SSL证书,或者增加连接超时时间来解决这个问题。

以下是一些可能有用的步骤:

更新SDK版本或JDK:尝试使用最新的SDK版本或JDK来运行您的代码。这可能会解决您遇到的问题。

手动安装SSL证书:如果您知道正确的SSL证书,您可以尝试手动安装它。这可以解决与证书不匹配相关的问题。

增加连接超时时间:如果您的代码连接OSS存储系统的速度较慢,您可以尝试增加连接超时时间。您可以在代码中使用以下代码来设置连接超时时间:

java AliyunOSSUtils utils = new AliyunOSSUtils();

utils.setConnectionTimeout(10000); // 设置连接超时时间为10秒

OSS oss = utils.init(); 希望这些步骤能够帮助您解决这个问题。如果问题仍然存在,请提供更多的异常信息,以便我们更好地帮助您解决问题。


关于本问题的更多回答可点击原文查看:https://developer.aliyun.com/ask/521540

相关实践学习
借助OSS搭建在线教育视频课程分享网站
本教程介绍如何基于云服务器ECS和对象存储OSS,搭建一个在线教育视频课程分享网站。
目录
相关文章
|
1天前
|
弹性计算 关系型数据库 MySQL
【阿里云弹性计算】从零搭建:基于阿里云ECS的高性能Web服务部署实践
【5月更文挑战第21天】本文介绍了如何使用阿里云ECS搭建高性能Web服务。首先,注册阿里云账号购买ECS实例,选择合适配置。接着,通过SSH连接实例,更新系统并安装Apache、PHP和MySQL。创建网站目录,上传代码,配置数据库和PHP。然后,启用Gzip压缩和KeepAlive,调整Apache并发连接数以优化性能。此教程为在阿里云上构建高效Web服务提供了基础指南。
30 5
|
2天前
|
网络协议
阿里云服务器搭建DNS解析服务步骤
在阿里云搭建DNS解析服务,首先注册阿里云账号并购买适合的云服务器。获取服务器公网IP后,配置服务器并安装DNS软件如Bind9。接着设置DNS解析,包括定义顶级和子域名的指向。最后,通过ping测试或浏览器访问验证DNS解析功能是否正常。
|
2天前
|
存储 弹性计算 监控
【阿里云弹性计算】阿里云ECS全面解析:弹性计算服务的核心优势与应用场景
【5月更文挑战第20天】阿里云ECS是提供可伸缩计算能力的云服务,支持多种规格实例,满足不同需求。其核心优势包括灵活性、高性能、高可用性、安全性和易用性。适用场景包括网站托管、大数据处理、游戏多媒体应用及测试开发环境。通过Python示例代码展示了如何创建ECS实例,助力企业专注业务发展,简化基础设施管理。
31 5
|
7天前
|
Web App开发 安全 Unix
Linux 配置FTP服务器 + vsftpd服务安装配置 (Good篇)
Linux 配置FTP服务器 + vsftpd服务安装配置 (Good篇)
|
7天前
|
存储 监控 安全
如何利用服务器为个人和企业提供定制服务?
【5月更文挑战第4天】如何利用服务器为个人和企业提供定制服务?
26 11
|
7天前
|
存储 运维 安全
服务器数据恢复—异常断电导致RAID5阵列信息丢失的数据恢复案例
服务器数据恢复环境: 某品牌ProLiant DL380系列服务器,服务器中有一组由6块SAS硬盘组建的RAID5阵列,WINDOWS SERVER操作系统,作为企业内部文件服务器使用。 服务器故障: 机房供电几次意外中断,服务器出现故障前最后一次异常断电重启后RAID报错,提示无法找到存储设备,进入RAID管理模块做任何操作都死机,重启服务器后问题依旧,用户联系北亚企安数据恢复中心寻求帮助。
|
7天前
|
弹性计算 运维 Serverless
Serverless 应用引擎产品使用之在阿里函数计算中,使用阿里云API或SDK从函数计算调用ECS实例的服务如何解决
阿里云Serverless 应用引擎(SAE)提供了完整的微服务应用生命周期管理能力,包括应用部署、服务治理、开发运维、资源管理等功能,并通过扩展功能支持多环境管理、API Gateway、事件驱动等高级应用场景,帮助企业快速构建、部署、运维和扩展微服务架构,实现Serverless化的应用部署与运维模式。以下是对SAE产品使用合集的概述,包括应用管理、服务治理、开发运维、资源管理等方面。
49 4
|
7天前
|
存储 安全 网络安全
服务器异常的处理(一)
【4月更文挑战第17天】提高服务器的安全
20 1
|
7天前
|
存储 JSON 前端开发
Javaweb之SpringBootWeb案例之阿里云OSS服务集成的详细解析
Javaweb之SpringBootWeb案例之阿里云OSS服务集成的详细解析
27 0
|
7天前
|
存储 开发工具 对象存储
Javaweb之SpringBootWeb案例之阿里云OSS服务入门的详细解析
Javaweb之SpringBootWeb案例之阿里云OSS服务入门的详细解析
27 0

热门文章

最新文章

相关产品

  • 对象存储