开发者社区> 问答> 正文

关于MultipartUpload上传文件问题

本人刚刚接触OSS,使用aliyun_java_sdk_20151124中OSSMultipartSample.java例子实现大文件分块上传,demo中的例子能执行成功,但是搬到web程序中就报错了
求助,不知道为什么截图上传图片很模糊

14:41:22,578  WARN oss:62 - [Client]Unable to execute HTTP request: Unknown
com.aliyun.oss.ClientException: Unknown
        at com.aliyun.oss.common.utils.ExceptionFactory.createNetworkException(ExceptionFactory.java:68)
        at com.aliyun.oss.common.comm.DefaultServiceClient.sendRequestCore(DefaultServiceClient.java:67)
        at com.aliyun.oss.common.comm.ServiceClient.sendRequestImpl(ServiceClient.java:121)
        at com.aliyun.oss.common.comm.ServiceClient.sendRequest(ServiceClient.java:67)
        at com.aliyun.oss.internal.OSSOperation.send(OSSOperation.java:89)
        at com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:130)
        at com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:108)
        at com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:103)
        at com.aliyun.oss.internal.OSSMultipartOperation.uploadPart(OSSMultipartOperation.java:319)
        at com.aliyun.oss.OSSClient.uploadPart(OSSClient.java:696)
        at com.centralsoft.core.utils.FileUtils.multipartUpload(FileUtils.java:160)
        at com.centralsoft.core.utils.FileUtils.uploadFile(FileUtils.java:94)
        at com.centralsoft.web.wjgl.WjglController.upload(WjglController.java:162)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:403)
        at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:358)
        at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:139)
        at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:684)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:392)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:357)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.centralsoft.filter.requestToHashMap.doFilter(requestToHashMap.java:44)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.centralsoft.filter.SetCharacterEncoding.doFilter(SetCharacterEncoding.java:28)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.centralsoft.filter.SetCharacterEncoding.doFilter(SetCharacterEncoding.java:28)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.centralsoft.filter.AccessControlFilter.doFilter(AccessControlFilter.java:127)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:137)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.http.NoHttpResponseException: dingshenghua.oss-cn-hangzhou.aliyuncs.com:80 failed to respond
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:143)
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
        at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
        at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:283)
        at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:251)
        at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:197)
        at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272)
        at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124)
        at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:685)
        at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:487)
        at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:882)
        at com.aliyun.oss.common.comm.DefaultServiceClient.sendRequestCore(DefaultServiceClient.java:64)
        ... 50 more



展开
收起
陈尚波 2015-12-10 09:51:18 15282 0
5 条回答
写回答
取消 提交回答
  • Re关于MultipartUpload上传文件问题
    我也碰到同样的问题,请问你是怎么解决的?
    2016-04-15 17:02:33
    赞同 展开评论 打赏
  • 回 7楼(陈尚波) 的帖子
    OSSClient实例是如何产生的,是作为Spring的bean注入的么?
    2015-12-11 15:31:35
    赞同 展开评论 打赏
  • 回 1楼shinenuaa的帖子
    不知道什么原因,QQ截图上传的图片会很模糊,我直接把错误贴出来了

    -------------------------

    回 4楼wood23的帖子
    今天我做下载才做也是提示这个错误,我是申请的OSS免费试用,时间没有到期,为什么会禁止用了,是流量到一定限制了吗

    -------------------------

    回 5楼wood23的帖子
    java1.6版本,tomcat发布的web项目,代码就是参考aliyun_java_sdk_20151124中OSSMultipartSample.java例子

    -------------------------

    回 9楼莫名的帖子
    项目启动spring注入需要的参数,初始化方法中new OSSClient实例的,参考的是aliyun_java_sdk_20151124中OSSMultipartSample.java
    2015-12-10 14:45:05
    赞同 展开评论 打赏
  • 看到楼上的评论我就放心了,我还以为是我眼花呢。。。

    -------------------------

    $curl dingshenghua.oss-cn-hangzhou.aliyuncs.com
    <?xml version="1.0" encoding="UTF-8"?>
    <Error>
      <Code>UserDisable</Code>
      <Message>UserDisable</Message>
      <RequestId>56696FD3957EEB2E70947966</RequestId>
      <HostId>dingshenghua.oss-cn-hangzhou.aliyuncs.com</HostId>
    </Error>

    楼主,这个用户好像被禁止了呢。

    -------------------------

    回 4楼(wood23) 的帖子
    另外从错误上,这个请求根本没发到OSS上。
    你用的是Java的什么版本啊?
    另外初始化的时候是怎么填的?注意不要泄露你的AccessKeyId, AccessKeySecret

    -------------------------

    注:北京\深圳\上海区域送免费额度。每个区域的免费额度包括:5GB存储容量、5GB/月外网流出流量、5万次/月Put类请求、50万次/月Get类请求 ,此免费额度有效期到2015年底。

    没有提杭州地区有免费额度。应该是欠费被停了吧。

    https://help.aliyun.com/knowledge_detail/5974488.html 价格表


    Java SDK的版本是?从错误来看是请求根本没有发送成功。

    2015-12-10 12:12:27
    赞同 展开评论 打赏
  • 回 楼主(陈尚波) 的帖子
    楼主,你发出来的是乱码
    2015-12-10 10:18:02
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Architecting a Multi-Tenanted 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载