AnsweredAssumed Answered

problem with contentService.write

Question asked by madhurao on Jul 27, 2009
Latest reply on Mar 13, 2013 by jovs
Hello guys,

I am getting an error with the following Code when the file content size is more than 15mb even if i have executed command with java -Xms512m -Xmx1024m -XX:MaxPermSize=256m TestUploadFile. When i make:

FileInputStream is = new FileInputStream(path);
byte[] bytes = ContentUtils.convertToByteArray(is);
ContentFormat format = new ContentFormat(contType, "UTF-8");
//Write the content
contentService.write(content, Constants.PROP_CONTENT, bytes, format);

the above code is working fine when the file content size is upto 15mb but if size of a file is more than 15 mb then i am getting the follwing(java.lang.OutOfMemoryError: Java heap space) error in tomcat server console.

error showing in tomcat server console:
01:40:19,082 User:admin INFO  [apache.axis.EXCEPTIONS] Exception:
java.lang.OutOfMemoryError: Java heap space
        at java.io.CharArrayWriter.write(CharArrayWriter.java:88)
        at org.apache.axis.message.SOAPHandler.characters(SOAPHandler.java:169)
        at org.apache.axis.encoding.DeserializationContext.characters(DeserializationContext.java:966)
       
error showing in command prompt console:

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString: java.lang.OutOfMemoryError: Java heap space; nested exception is:
        java.lang.OutOfMemoryError: Java heap space
faultActor:
faultNode:
faultDetail:
        {http://xml.apache.org/axis/}hostname:XXXXX-xxx

java.lang.OutOfMemoryError: Java heap space; nested exception is:
        java.lang.OutOfMemoryError: Java heap space

Please help me how can i resolve this issue?

Thanks,
Madhu

Outcomes