cancel
Showing results for 
Search instead for 
Did you mean: 

CMISRunTimeException Uploading 20 MB File

hari
Star Contributor
Star Contributor
Hi All,

I am using the below code to upload file to Alfresco. It runs fine for smaller sized documents but is failing for files of sizes around 20MB.


   public String uploadDocument(String docType, File file) throws IOException, SiteNotFoundException, DocumentLibraryNotFoundException {
      Map<String, String> props = new HashMap<String, String>();
      props.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
      props.put(PropertyIds.NAME, file.getName());
      FileInputStream input = new FileInputStream(file);
      
      CUDDocuments docsCUD = new CUDDocuments();
      Folder target = docsCUD.getTargetFolder(docType);


      ContentStream contentStream = MySession.getSession().getObjectFactory()
            .createContentStream(file.getName(), -1,
                  "application/octet-stream", input);
      
      Document doc = target.createDocument(props, contentStream, VersioningState.MAJOR);
      
      contentStream.getStream().close();
      return doc.getId();
   }

Help me with your thoughts how I can fix this. Thanks.

Regards,
Hari.
2 REPLIES 2

rjohnson
Star Contributor
Star Contributor
Dependent upon how you access your Alfresco there are upload size limits on Apache and Tomcat. Most likely you are tripping over one of these limits. Check your apache & tomcat logs.

hari
Star Contributor
Star Contributor
Thanks for your reply Johnson. I was not sure where to check for those details. Please let me know if you are aware of those.

For time being, I found a way out. Someone posted a blog about the same issue in the link below.
http://basanagowdapatil.blogspot.in/2011/10/how-to-upload-file-to-alfresco-share.html

For those of you who ran into the same sort of issue, hope the above link helps you out too.