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

五杀联盟 发布于 2014/10/29 09:48
阅读 1K+
收藏 0
[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
 报错误如上所示
加载中
0
五杀联盟
五杀联盟

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

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

0
s
shylock
这个是  cos 这个jar的问题,在解析boundary的时候  解析出错, 要去改 extractBoundary() 方法!!!!
0
愚_者
愚_者
用jetty服务器也报这个错 @JFinal
JFinal
JFinal
jetty 没这个错误吧,用了很久了,那应该是 xheditor 上传的格式不对
0
JFinal
JFinal
     这个是解析上传文件流的时候出现了格式错误,可能是上传客户端有误,也有可能是 cos 不支持楼主这种上传格式,如果确实是 cos 的问题,可以在 controller 中通过 getRequest() 得到 HttpServletRequest() 对象,然后用其它第三方 api 解析出 request 对象中的文件来,其实 cos 也是这样做的,现只要换一种解析方式即可
五杀联盟
五杀联盟
这个错误是xheditor 的html5上传方式,cos不识别导致的。但是cos还有个问题是不支持glass fish
返回顶部
顶部