SAP Knowledge Base Article - Preview

3195493 - "java.lang.OutOfMemoryError" when uploading files over 2GB in Backoffice - SAP Commerce

Symptom

When uploading files in Backoffice using the DragAndDropFileUploadEditor, if the file size is over 2GB, the upload is failed with "Internal Server Error".

In console log, "java.lang.OutOfMemoryError" exception is output.

  • For SAP Commerce versions after (including) 1905,
    • if the uploaded file is binary file:
      
java.lang.OutOfMemoryError: Required array size too large
 at java.io.InputStream.readNBytes(InputStream.java:404) ~[?:?]
 at java.io.InputStream.readAllBytes(InputStream.java:333) ~[?:?]
 at com.hybris.cockpitng.editor.dndfileupload.AbstractDragAndDropFileUploadEditor.extractUploadedData(AbstractDragAndDropFileUploadEditor.java:239) ~[backoffice-widgets-21.05.9-RC2.jar:?]
    • if the uploaded file is text-based format:
      
java.lang.OutOfMemoryError: null
 at java.lang.AbstractStringBuilder.hugeCapacity(AbstractStringBuilder.java:214) ~[?:?]
 at java.lang.AbstractStringBuilder.newCapacity(AbstractStringBuilder.java:206) ~[?:?]
 at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:173) ~[?:?]
 at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:686) ~[?:?]
 at java.lang.StringBuffer.append(StringBuffer.java:409) ~[?:?]
 at java.io.StringWriter.write(StringWriter.java:99) ~[?:?]
 at org.zkoss.io.Files.copy(Files.java:95) ~[zcommon-8.6.3.jar:8.6.3]
 at org.zkoss.io.Files.readAll(Files.java:81) ~[zcommon-8.6.3.jar:8.6.3]
 at org.zkoss.util.media.AMedia.getStringData(AMedia.java:321) ~[zcommon-8.6.3.jar:8.6.3]
 at com.hybris.cockpitng.editor.dndfileupload.AbstractDragAndDropFileUploadEditor.extractUploadedData(AbstractDragAndDropFileUploadEditor.java:249) ~[backoffice-widgets-21.05.9-RC2.jar:?]
  • For SAP Commerce versions before (not including) 1905:
java.lang.OutOfMemoryError: null
at java.io.ByteArrayOutputStream.hugeCapacity(Unknown Source) ~[?:1.8.0_171]
at java.io.ByteArrayOutputStream.grow(Unknown Source) ~[?:1.8.0_171]
at java.io.ByteArrayOutputStream.ensureCapacity(Unknown Source) ~[?:1.8.0_171]
at java.io.ByteArrayOutputStream.write(Unknown Source) ~[?:1.8.0_171]
at org.zkoss.io.Files.readAll(Files.java:69) ~[zcommon-8.5.0.jar:8.5.0]
at org.zkoss.util.media.AMedia.getByteData(AMedia.java:306) ~[zcommon-8.5.0.jar:8.5.0]
at com.hybris.cockpitng.editor.dndfileupload.AbstractDragAndDropFileUploadEditor.extractUploadedData(AbstractDragAndDropFileUploadEditor.java:180) ~[backoffice-widgets-6.7.0.1-RC1.jar:?]
  

Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.


    Read more...

    Environment

    All SAP Commerce versions

    Product

    SAP Commerce all versions

    Keywords

    outofmemory, OOM, upload file failed, FileUploadEditor, backoffice, commerce, sap commerce,upload file , KBA , CEC-SCC-CDM-BO-FRW , Framework , CEC-COM-ADM-BO , Backoffice , Problem

    About this page

    This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

    Search for additional results

    Visit SAP Support Portal's SAP Notes and KBA Search.