Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何修复org.jvnet.mimepull.MIMEParsingException?_Java_Angularjs_File Upload_Jax Rs_Mime Types - Fatal编程技术网

Java 如何修复org.jvnet.mimepull.MIMEParsingException?

Java 如何修复org.jvnet.mimepull.MIMEParsingException?,java,angularjs,file-upload,jax-rs,mime-types,Java,Angularjs,File Upload,Jax Rs,Mime Types,在使用JAX-RS(Jersey)将image/doc/xlsx文件从AngularJS客户端上载到服务器端java时,我遇到以下异常: org.jvnet.mimepull.MIMEParsingException: Reached EOF, but there is no closing MIME boundary. 这是什么?为什么我会得到这个例外?我怎样才能摆脱这个 注意:它适用于扩展名为.txt、.html、.yml、.java、.properties的文件 但不适用于扩展名为.do

在使用JAX-RS(Jersey)将image/doc/xlsx文件从AngularJS客户端上载到服务器端java时,我遇到以下异常:

org.jvnet.mimepull.MIMEParsingException: Reached EOF, but there is no closing MIME boundary.
这是什么?为什么我会得到这个例外?我怎样才能摆脱这个

注意:它适用于扩展名为
.txt、.html、.yml、.java、.properties的文件
但不适用于扩展名为
.doc、.xlsx、.png、.png、.jpeg.的文件。。等等。

我的服务器端代码:

@POST
@Path("/{name}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public String uploadedFiles(@Nonnull @PathParam("name") final String name,
        @FormDataParam("file") final InputStream inputStream,
        @FormDataParam("file") final FormDataContentDisposition content) {
}

好的,我只是在猜测,但我想我可以看到一个模式

  • 正在工作的文件类型是基于文本的
  • 不工作的文件类型是二进制文件
这向我表明,问题可能在于上传过程处理非文本数据的方式存在某种问题。也许它在不应该的时候被转码了


无论如何,我建议您使用Wireshark之类的工具来捕获上传中的TCP/IP流量,以查看上传请求主体是否具有有效的MIME封装

好吧,我只是在猜测,但我想我可以在这里看到一种模式

  • 正在工作的文件类型是基于文本的
  • 不工作的文件类型是二进制文件
这向我表明,问题可能在于上传过程处理非文本数据的方式存在某种问题。也许它在不应该的时候被转码了


无论如何,我建议您使用Wireshark之类的工具来捕获上传中的TCP/IP流量,以查看上传请求主体是否具有有效的MIME封装

我遇到了同样的问题。根据我的研究,这个问题与文件类型无关。它与上传文件的大小有一点关系

我不确定根本原因是否是上载文件很大,在文件完全上载到服务器之前,客户端断开了与服务器的连接(例如超时)。我也验证了猜测。我的测试步骤是

1. In client, upload a very big file.      
2. Before the get the response from server, which means is uploading file; 
   close the test client
3. check the server side, you will see the issue.

因此,为了解决这个问题,我的解决方案是在客户端添加超时时间。

我遇到了同样的问题。根据我的研究,这个问题与文件类型无关。它与上传文件的大小有一点关系

我不确定根本原因是否是上载文件很大,在文件完全上载到服务器之前,客户端断开了与服务器的连接(例如超时)。我也验证了猜测。我的测试步骤是

1. In client, upload a very big file.      
2. Before the get the response from server, which means is uploading file; 
   close the test client
3. check the server side, you will see the issue.

因此,为了解决这个问题,我的解决方案是在客户端添加超时时间。

您解决了问题吗?您解决了问题吗?如何在客户端添加超时时间?如何在客户端添加超时时间?