When executing following code in docker context, the page just hangs and I do not get any exceptions either:
File file = fileService.createTempFile('some-file.xlsx')
log.info("CREATED EXCEL FILE : ${file.path}")
Workbook workbook = new SXSSFWorkbook(SXSSFWorkbook.DEFAULT_WINDOW_SIZE)
log.info("WORKBOOK CREATED")
workbook.createSheet(WorkbookUtil.createSafeSheetName('TEST'))
log.info("SHEET CREATED")
FileOutputStream fos = new FileOutputStream(file)
workbook.write(fos)
//workbook.dispose()
fos.close()
I can see the file is craeted and also see WORKBOOK CREATED log generated but nothing after that. This happens only when running the code in the docker container and not when I run the app outside of docker context.
I am using poi 4.1.2 and jdk 11.0.16.
UPDATE: I have read on other posts about the temp directory not existing or not being writable. Just to test this out, I went to the node and created pre-defined folder with all read write permissions as well and updated the code to point SXXF to write to that temp folder as well :
try {
//THIS FOLDER ALREADY EXISTS IN NODE AND HAS ALL PERMS
String path = '/usr/local/tomcat/temp/reporting-service-16769203353988068118/'
File tmpdir = new File(path)
log.info("TMP DIR IS ${tmpdir.path}")
File file = new File("${tmpdir.path}/surveyQuestionExport.xlsx")
log.info("CREATED EXCEL FILE : ${file.path}")
TempFile.setTempFileCreationStrategy(new DefaultTempFileCreationStrategy(tmpdir))
Workbook workbook = new SXSSFWorkbook(new XSSFWorkbook(), SXSSFWorkbook.DEFAULT_WINDOW_SIZE)
log.info("WORKBOOK CREATED")
workbook.createSheet(WorkbookUtil.createSafeSheetName('TEST'))
log.info("SHEET CREATED")
FileOutputStream fos = new FileOutputStream(file)
workbook.write(fos)
workbook.dispose()
fos.flush()
fos.close()
return file
} catch (Exception ex) {
log.error("EXPORT FAILED", ex)
}
But still same issue.