[CMA-23] Uploading large files throws OutOfMemoryError for the Java heap space Created: 09/Jul/08  Updated: 15/Oct/10

Status: Open
Project: Remote Alfresco API rivet
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Al El-Nattar Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CMA-16 Improve the readContentIntoStream(..)... Open

 Description   
My webapp uploads from the browser to the client into a temp file that is located on the Tomcat running my webapp. After that I make the following CMA call using that file (file is the temp file that I created):

myMethod() {
    ...
    CMAUtil.writeContentFromStream(this.cmaServices, this.user.getTicket(), fileRef, ContentModel.TYPE_CONTENT, new FileInputStream(file));
    ...
}

public static void writeContentFromStream(CMAServices cmaServices, Ticket ticket, NodeRef childRef,
    QName nodeTypeQName, InputStream inputStream) throws NodeLockedException, InvalidTicketException, CmaRuntimeException {

    cmaServices.getContentService().writeContentFromStream(ticket, childRef, nodeTypeQName, inputStream);
}

At some point the following exception is thrown.

com.rivetlogic.core.cma.exception.CmaRuntimeException: java.lang.OutOfMemoryError: Java heap space
        at com.rivetlogic.core.cma.impl.ContentServiceImpl.writeContentFromStream(ContentServiceImpl.java:124)
        at com.jpmc.athenaeum.util.CMAUtil.writeContentFromStream(CMAUtil.java:320)
        at com.jpmc.athenaeum.listeners.UploadContentListener.writeContent(UploadContentListener.java:209)
        at com.jpmc.athenaeum.listeners.UploadContentListener.upload(UploadContentListener.java:160)
        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:585)
        at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
        at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
        at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        at org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
        at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
        at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
        at com.jpmc.athenaeum.listeners.UploadContentListener_$$_javassist_16.upload(UploadContentListener_$$_javassist_16.java)
        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:585)
        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341)
        at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
        at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
        at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
        at org.jboss.seam.el.OptionalParameterMethodExpression.invoke(OptionalParameterMethodExpression.java:39)
        at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
        at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
        at org.richfaces.component.UIFileUpload.broadcast(UIFileUpload.java:160)
        at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:316)
        at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:289)
        at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:248)
        at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:404)
        at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:101)
        at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 
Generated at Sat Feb 10 05:51:22 GMT 2024 using Jira 8.1.3#801003-sha1:6b6f07cffadda9a0d6efe24639daed8ce94dcdd6.