How to avoid OutOfMemoryError when uploading a large file using Jersey client

前端 未结 6 2112
难免孤独
难免孤独 2020-11-28 08:14

I am using Jersey client for http-based request. It works well if the file is small but run into error when I post a file with size of 700M:

Exception in thr         


        
6条回答
  •  孤城傲影
    2020-11-28 09:04

    If possible, can you split the file you send into smaller parts? This will reduce memory usage, but you need to change the code on both sides of the uploading/downloading code.

    If you can't, then your heap space is too low, try increasing it with this JVM parameter. In your application server add/change the Xmx JVM options. For example

    -Xmx1024m
    

    to set Max Heap Space to 1Gb

提交回复
热议问题