AnsweredAssumed Answered

Upload  Batch files

Question asked by americanolinhares on Sep 1, 2015
Latest reply on Jan 19, 2017 by binduwavell
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(
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createDocument(
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(
   at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(
   at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(
   at com.most.cmis.client.CMISTestClient.uploadDocumento(
   at com.most.parascript.export.DirectoryWatcher.SpecificRule(
   at com.most.parascript.export.DirectoryWatcher.fileEvents(
   at Source)

I tried this but it doesn't work:

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()];      
      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