cancel
Showing results for 
Search instead for 
Did you mean: 

Upload Batch files

americanolinhar
Champ on-the-rise
Champ on-the-rise
Hi, I have the following problem:

I have an external java module that performs the upload of documents to Alfresco via CMIS.
For now I upload two types of files - pdf and jpg.
When I  upload only 200 PDF files it works correctly. When I upload 200 jpg files also it  works correctly too. However when I try to insert 400 files - 200 jpg and pdf 200 the following occurs:
The first 200 files - of the same type - are inserted correctly (eg 200 jpg). But in the first pdf file (the file number 201) the error occurs:

Exception in thread "Thread-0" org.apache.chemistry.opencmis.commons.exceptions.CmisStorageException: Expected 69489 bytes but retrieved 0 bytes!
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:493)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:650)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createDocument(ObjectServiceImpl.java:121)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:1043)
   at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:77)
   at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:451)
   at com.most.cmis.client.CMISTestClient.uploadDocumento(CMISTestClient.java:307)
   at com.most.parascript.export.DirectoryWatcher.SpecificRule(DirectoryWatcher.java:63)
   at com.most.parascript.export.DirectoryWatcher.fileEvents(DirectoryWatcher.java:172)
   at com.most.parascript.export.DirectoryWatcher.run(DirectoryWatcher.java:203)
   at java.lang.Thread.run(Unknown Source)


I tried this but it doesn't work:  https://forums.alfresco.com/forum/developer-discussions/alfresco-api/cmisstorageexception-checkin-06...

Comments:
All PDF files have the same size - 509 KB
All JPG files have the same size - 68 KB
When I do the same test with a smaller amount of files, eg 5 pdf's and 5 jpg's it works properly.




Below the section of code that uploads:


                folderEntrada = (Folder) session.getObjectByPath("/sites/most/documentLibrary/clasComChave");
           File file = new File(caminhoArquivo);
      InputStream fis = new FileInputStream(file);
      VersioningState vs = VersioningState.MAJOR;
      DataInputStream dis = new DataInputStream(fis);
      byte[] bytes = new byte[(int) file.length()];      
      
      dis.readFully(bytes);
      
      ContentStream contentStream = new ContentStreamImpl(file.getAbsolutePath(), BigInteger.valueOf(bytes.length), tipoArquivo, new ByteArrayInputStream(bytes));

         AlfrescoDocument novoDocumento = (AlfrescoDocument) folderEntrada.createDocument(properties, contentStream, vs);


Does anyone have any idea that can help me?



Windows 8
4.2.f Community
1 REPLY 1

binduwavell
Star Contributor
Star Contributor

I have a client that appears to be experiencing a similar issue with Alfresco Enterprise 5.1.1.