Hi,
I have an import job that processes data from an Excel file to create documents. When I run the job using multithreading, I randomly encounter the following exception:
[WARN ][.support.internal.DefaultDocumentSupport][u:] - Deserialization of document has failed. Reason: For the entity instance '/FullPartTime[1]', the corresponding entity was not found in the corresponding document model. [ERROR,L0,s0,e0],
For the entity instance '/VacationFulltime[1]', the corresponding entity was not found in the corresponding document model. [ERROR,L0,s0,e0],
For the entity instance '/VacationParttime[1]', the corresponding entity was not found in the corresponding document model. [ERROR,L0,s0,e0],
For the entity instance '/WeekHoursHHMM[1]', the corresponding entity was not found in the corresponding document model. [ERROR,L0,s0,e0],
2024-11-21 05:05:52,242 [pool-5-thread-1 ][ERROR][ee.importdata.service.ExcelImportService][u:] - Failed to creating employee data for personalId: 4075
com.mgmtp.a12.dataservices.utils.internal.DocumentModelException: The validation of document of document model 'ContractHourAbsenceDM' failed. For the entity instance '/FullPartTime[1]', the corresponding entity was not found in the corresponding document model. [ERROR,L0,s0,e0],
For the entity instance '/VacationFulltime[1]', the corresponding entity was not found in the corresponding document model. [ERROR,L0,s0,e0],
For the entity instance '/VacationParttime[1]', the corresponding entity was not found in the corresponding document model. [ERROR,L0,s0,e0],
It happened randomly, If I re-import the same file, the exception is occurred for another document.
But if I execute in in one thread, it works fine, there is no exception.
My code of using mulithread looks like this:
ExecutorService executorService = Executors.newFixedThreadPool(numberOfPools);
ExecutorService securityExecutorService = new DelegatingSecurityContextExecutorService(executorService);
List<Callable<Result>> tasks = new ArrayList<>();
documentDataMap.forEach((key, value) -> tasks.add(() -> importData(key, value)));
List<Future<Result>> results = securityExecutorService.invokeAll(tasks);
In the function importData() I use “AddDocumentOperation addDocumentOperation” to create A12 document.
When I tried with numberOfPools=2, I still got that problem.
What should I do to solve this problem? Thank you!