开发者社区> 问答> 正文

用JFinal上传文件时报错:Separation boundary was n?报错

@JFinal 你好,想跟你请教个问题:用JFinal上传时报错:java.lang.RuntimeException: java.io.IOException: Separation boundary was not specified
at com.jfinal.upload.MultipartRequest.wrapMultipartRequest(MultipartRequest.java:121)
at com.jfinal.upload.MultipartRequest.<init>(MultipartRequest.java:69)
at com.jfinal.core.Controller.getFiles(Controller.java:625)
at com.jfinal.core.Controller.getFile(Controller.java:637)
at com.skg.controller.tb_shop_returnController.save(tb_shop_returnController.java:92)
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 com.jfinal.core.ActionInvocation.invoke(ActionInvocation.java:55)
at com.skg.interceptor.LoginInterceptor.intercept(LoginInterceptor.java:17)
at com.jfinal.core.ActionInvocation.invoke(ActionInvocation.java:51)
at com.skg.interceptor.GlobalInterceptor.intercept(GlobalInterceptor.java:30)
at com.jfinal.core.ActionInvocation.invoke(ActionInvocation.java:51)
at com.jfinal.ext.interceptor.SessionInViewInterceptor.intercept(SessionInViewInterceptor.java:44)
at com.jfinal.core.ActionInvocation.invoke(ActionInvocation.java:51)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:73)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:365)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:937)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:998)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.IOException: Separation boundary was not specified
at com.oreilly.servlet.multipart.MultipartParser.<init>(MultipartParser.java:182)
at com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:223)
at com.jfinal.upload.MultipartRequest.wrapMultipartRequest(MultipartRequest.java:105)
... 40 more

这是哪里的问题

展开
收起
爱吃鱼的程序员 2020-06-22 15:08:18 1374 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    目测cos在处理Request流时出错,边界检查出错。你看下你提交的form表单设置成

    enctype="multipart/form-data"了吗?

    设了,我是异步上传文件添加了 也不行啊method="POST"设置了没? 上传的文件是否在本地正被打开,有些文件类型在打开的时候不允许上传操作回复 @JFinal:嗯,好的!谢谢大神指点!回复 @zhu_xu:试试终极方案,在控制器或者拦截器之中使用getRequest()拿到HttpServletRequest对象,然后对该对象进行解析,得到文件,有很多第三方的解析工具,例如commonupload回复 @JFinal:刚刚看了一下源码,我用的是getPara()直接获取图片,那个参数只是针对getFile()方法使用的!回复 @JFinal:通过me.setMaxPostSize(。。。);设置之后还是报287026>200000回复 @zhu_xu:me.setMaxPostSize(....)或者在getFile(...)时指定长度,默认是10M
    2020-06-22 15:08:35
    赞同 展开评论 打赏
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Apache Wicket User Guide - Ref 立即下载
Apache Wicket User Guide-Refer 立即下载
How to Integrate Spark MLlib and Apache Solr to Build Real-Time Entity Type Recognition System for Better Query Understanding 立即下载