xheditor 上传图片 Jfinal处理 出现异常

发布于 2021-11-26 16:53:59 字数 4493 浏览 714 评论 5

[ERROR]-[Thread: http-listener-1(4)]-[com.jfinal.core.ActionHandler.handle()]: /backend/user/UploadImg

java.lang.RuntimeException: java.io.IOException: Corrupt form data: premature ending

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

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

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

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

at com.tongchengjinrong.actions.backend.BaseController.UploadImg(BaseController.java:118)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

at com.jfinal.core.ActionInvocation.invoke(ActionInvocation.java:55)

at com.tongchengjinrong.base.AddFilter.intercept(AddFilter.java:16)

at com.jfinal.core.ActionInvocation.invoke(ActionInvocation.java:51)

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

at com.jfinal.ext.handler.ContextPathHandler.handle(ContextPathHandler.java:47)

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

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

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

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

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

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)

at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)

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

at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)

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

at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)

at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)

at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)

at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)

at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)

at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)

at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)

at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)

at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)

at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)

at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)

at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)

at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)

at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)

at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)

at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)

at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)

at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)

at java.lang.Thread.run(Thread.java:745)

Caused by: java.io.IOException: Corrupt form data: premature ending

at com.oreilly.servlet.multipart.MultipartParser.<init>(MultipartParser.java:207)

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

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

... 43 more

 报错误如上所示

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

冷默言语 2021-11-29 18:42:08

     这个是解析上传文件流的时候出现了格式错误,可能是上传客户端有误,也有可能是 cos 不支持楼主这种上传格式,如果确实是 cos 的问题,可以在 controller 中通过 getRequest() 得到 HttpServletRequest() 对象,然后用其它第三方 api 解析出 request 对象中的文件来,其实 cos 也是这样做的,现只要换一种解析方式即可

倚栏听风 2021-11-29 18:42:03

这个是  cos 这个jar的问题,在解析boundary的时候  解析出错, 要去改 extractBoundary() 方法!!!!

瑾兮 2021-11-29 18:32:26

Glass Fish  服务器不兼容jfinal的上传组件 

在tomcat下是正常的 请jfinal修复一下@JFinal

心舞飞扬 2021-11-29 14:49:10

@红薯 helo

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文