jfinal 上传文件报错

com.lsk.common.interceptor.ExceptionInterceptor.intercept(18)java.lang.RuntimeException: java.io.EOFException: Unexpected EOF read on the socket

at com.jfinal.upload.MultipartRequest.wrapMultipartRequest(MultipartRequest.java:126)

at com.jfinal.upload.MultipartRequest.<init>(MultipartRequest.java:68)

at com.jfinal.core.Controller.getFiles(Controller.java:811)

at com.jfinal.core.Controller.getFile(Controller.java:821)

at com.lsk.qiniu.QiniuController.imgUpload(QiniuController.java:99)

at sun.reflect.GeneratedMethodAccessor64.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.jfinal.aop.Invocation.invoke(Invocation.java:73)

at com.lsk.common.interceptor.CacheInterceptor.intercept(CacheInterceptor.java:22)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at com.lsk.common.interceptor.ExceptionInterceptor.intercept(ExceptionInterceptor.java:16)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at com.jfinal.core.ActionHandler.handle(ActionHandler.java:83)

at com.lsk.handler.DruidStatViewHandlerRewrite.handle(DruidStatViewHandlerRewrite.java:75)

at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)

at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:498)

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:796)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1374)

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Unknown Source)

Caused by: java.io.EOFException: Unexpected EOF read on the socket

at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:712)

at org.apache.coyote.http11.Http11InputBuffer.access$300(Http11InputBuffer.java:40)

at org.apache.coyote.http11.Http11InputBuffer$SocketInputBuffer.doRead(Http11InputBuffer.java:1034)

at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:102)

at org.apache.coyote.http11.Http11InputBuffer.doRead(Http11InputBuffer.java:239)

at org.apache.coyote.Request.doRead(Request.java:551)

at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:318)

at org.apache.catalina.connector.InputBuffer.checkByteBufferEof(InputBuffer.java:611)

at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:341)

at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:132)

at com.oreilly.servlet.multipart.BufferedServletInputStream.fill(BufferedServletInputStream.java:64)

at com.oreilly.servlet.multipart.BufferedServletInputStream.readLine(BufferedServletInputStream.java:108)

at com.oreilly.servlet.multipart.LimitedServletInputStream.readLine(LimitedServletInputStream.java:60)

at com.oreilly.servlet.multipart.PartInputStream.fill(PartInputStream.java:97)

at com.oreilly.servlet.multipart.PartInputStream.read(PartInputStream.java:195)

at com.oreilly.servlet.multipart.PartInputStream.read(PartInputStream.java:156)

at com.oreilly.servlet.multipart.FilePart.write(FilePart.java:208)

at com.oreilly.servlet.multipart.FilePart.writeTo(FilePart.java:167)

at com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:272)

at com.jfinal.upload.MultipartRequest.wrapMultipartRequest(MultipartRequest.java:107)

... 37 more


评论区

JFinal

2019-10-19 17:12

异常已经很清楚:
Caused by: java.io.EOFException: Unexpected EOF read on the socket

改客户端代码,让上传方式为正确的

你妹啊

2019-10-21 09:46

好的,谢谢

你妹啊

2019-10-21 17:07

@JFinal 这个是在微信上面上传图片,大多数情况下不会报这个错,有少数情况会出现这个错误。我自己测试了,确实上传的是同一个图片,有时候会出错。这是什么原因?

热门反馈

扫码入社