开发者社区> 问答> 正文

OSS文件上传出错。。。

我用官方的例子测试本地上传没问题
但是当我用网页提交表单的方式上传就报出这个错了
=======================================================

十月 25, 2014 8:55:49 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [jsp] in context with path [/simple-erp] threw exception [com.aliyun.openservices.ClientException: 网络连接错误,详细信息:Read timed out] with root cause
java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:149)
    at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:111)
    at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:264)
    at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:98)
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:252)
    at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:282)
    at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:247)
    at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:216)
    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:298)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
    at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:647)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:464)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)
    at com.aliyun.common.comm.DefaultServiceClient.sendRequestCore(DefaultServiceClient.java:51)
    at com.aliyun.common.comm.ServiceClient.sendRequestImpl(ServiceClient.java:171)
    at com.aliyun.common.comm.ServiceClient.sendRequest(ServiceClient.java:136)
    at com.aliyun.openservices.oss.internal.OSSOperation.send(OSSOperation.java:59)
    at com.aliyun.openservices.oss.internal.OSSObjectOperation.putObject(OSSObjectOperation.java:76)
    at com.aliyun.openservices.oss.OSSClient.putObject(OSSClient.java:283)
    at com.erp.ueditor.upload.StorageManager.saveFile2OSS(StorageManager.java:244)
    at com.erp.ueditor.upload.BinaryUploader.save(BinaryUploader.java:87)
    at com.erp.ueditor.upload.Uploader.doExec(Uploader.java:26)
    at com.erp.ueditor.ActionEnter.invoke(ActionEnter.java:80)
    at com.erp.ueditor.ActionEnter.exec(ActionEnter.java:49)
    at org.apache.jsp.script.ueditor1_005f4_005f3_002dutf8_002djsp.controller_jsp._jspService(controller_jsp.java:74)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
================================================================================
后台用的是Apachecommons-fileupload来获取文件流的。(我在用 OSS 以前是可以正常上传的)
我把 InputStream is = fileStream.openStream();里的is作为putObject()方法的参数,这里出问题了吗?

展开
收起
凯哥 2014-10-25 21:27:33 18324 0
2 条回答
写回答
取消 提交回答
  • ReOSS文件上传出错。。。
    我也碰到同样的问题,请问你是怎么解决的?
    2016-04-15 16:59:44
    赞同 展开评论 打赏
  • oss不是很熟悉,不过 InputStream 是一个流,你如果直接作为对象放进去,肯定不行
    2014-11-27 14:12:51
    赞同 展开评论 打赏
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
OSS运维进阶实战手册 立即下载
《OSS运维基础实战手册》 立即下载
OSS运维基础实战手册 立即下载