对象存储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,搭建一个在线教育视频课程分享网站。
相关文章
|
2月前
|
存储 Java 开发工具
【三方服务集成】最新版 | 阿里云OSS对象存储服务使用教程(包含OSS工具类优化、自定义阿里云OSS服务starter)
阿里云OSS(Object Storage Service)是一种安全、可靠且成本低廉的云存储服务,支持海量数据存储。用户可通过网络轻松存储和访问各类文件,如文本、图片、音频和视频等。使用OSS后,项目中的文件上传业务无需在服务器本地磁盘存储文件,而是直接上传至OSS,由其管理和保障数据安全。此外,介绍了OSS服务的开通流程、Bucket创建、AccessKey配置及环境变量设置,并提供了Java SDK示例代码,帮助用户快速上手。最后,展示了如何通过自定义starter简化工具类集成,实现便捷的文件上传功能。
【三方服务集成】最新版 | 阿里云OSS对象存储服务使用教程(包含OSS工具类优化、自定义阿里云OSS服务starter)
|
2月前
|
存储 网络安全 对象存储
缺乏中间证书导致通过HTTPS协议访问OSS异常
【10月更文挑战第4天】缺乏中间证书导致通过HTTPS协议访问OSS异常
111 4
|
3月前
|
Java API 对象存储
微服务魔法启动!Spring Cloud与Netflix OSS联手,零基础也能创造服务奇迹!
这段内容介绍了如何使用Spring Cloud和Netflix OSS构建微服务架构。首先,基于Spring Boot创建项目并添加Spring Cloud依赖项。接着配置Eureka服务器实现服务发现,然后创建REST控制器作为API入口。为提高服务稳定性,利用Hystrix实现断路器模式。最后,在启动类中启用Eureka客户端功能。此外,还可集成其他Netflix OSS组件以增强系统功能。通过这些步骤,开发者可以更高效地构建稳定且可扩展的微服务系统。
60 1
|
4月前
|
存储 JavaScript 前端开发
Vue中实现图片上传,上传后的图片回显,存储图片到服务器 【使用对象存储OSS】
这篇文章介绍了在Vue中实现图片上传到阿里云OSS对象存储服务的完整流程,包括服务端签名直传的前提知识、后端设置、前端组件封装以及图片上传和回显的效果展示。
|
4月前
|
存储 机器学习/深度学习 弹性计算
阿里云EMR数据湖文件系统问题之OSS-HDFS全托管服务的问题如何解决
阿里云EMR数据湖文件系统问题之OSS-HDFS全托管服务的问题如何解决
|
5月前
|
分布式计算 DataWorks 调度
DataWorks产品使用合集之多个业务流程上传同名资源到同一个OSS(对象存储服务)URL,会产生什么问题
DataWorks作为一站式的数据开发与治理平台,提供了从数据采集、清洗、开发、调度、服务化、质量监控到安全管理的全套解决方案,帮助企业构建高效、规范、安全的大数据处理体系。以下是对DataWorks产品使用合集的概述,涵盖数据处理的各个环节。
|
4月前
|
弹性计算 JavaScript Ubuntu
ECS 挂载 OSS 多Bucket
ECS 挂载 OSS 多Bucket
90 0
|
5月前
|
运维 Serverless 数据处理
函数计算产品使用问题之在对象存储服务(OSS)上创建ZIP包解压触发器后,触发器未按预期执行,一般是什么导致的
函数计算产品作为一种事件驱动的全托管计算服务,让用户能够专注于业务逻辑的编写,而无需关心底层服务器的管理与运维。你可以有效地利用函数计算产品来支撑各类应用场景,从简单的数据处理到复杂的业务逻辑,实现快速、高效、低成本的云上部署与运维。以下是一些关于使用函数计算产品的合集和要点,帮助你更好地理解和应用这一服务。
|
5月前
|
机器学习/深度学习 人工智能 专有云
人工智能平台PAI使用问题之怎么将DLC的数据写入到另一个阿里云主账号的OSS中
阿里云人工智能平台PAI是一个功能强大、易于使用的AI开发平台,旨在降低AI开发门槛,加速创新,助力企业和开发者高效构建、部署和管理人工智能应用。其中包含了一系列相互协同的产品与服务,共同构成一个完整的人工智能开发与应用生态系统。以下是对PAI产品使用合集的概述,涵盖数据处理、模型开发、训练加速、模型部署及管理等多个环节。

相关产品

  • 对象存储