There was an attempt to implement the excel export function in an application using apache POI 3.17.
Everything worked fine on my local tomcat server and on Windows. However, the workbook.createSheet () SXSSFWorkbook method crashes on the tomcat linux server without causing any significant errors (it just hangs).
Oddly enough, the same method in the XSSFWorkbook createSheet class works just fine. The following are snippets of code. Has anyone experienced a similar problem before?
final SXSSFWorkbook workbook = new SXSSFWorkbook();
workbook.setCompressTempFiles(true);
SXSSFSheet sheet = workbook.createSheet("Sheet 1");
final XSSFWorkbook workbook = new XSSFWorkbook();
Sheet sheet = workbook.createSheet("Sheet 1");
Edit
I created a custom TempFileCreationStrategy so that tomcat writes the file to a directory to which it has full access. I see that the file was created, but it hangs when it tries to write any data to the file.
I can not understand this.
Edit2
POI, , . POI , :
[20:13:05,005]DEBUG (?:?) - Save core properties part
[20:13:05,005]DEBUG (?:?) - Save package relationships
[20:13:05,005]DEBUG (?:?) - Save content types part
[20:13:05,005]DEBUG (?:?) - Save part 'docProps/app.xml'
[20:13:05,005]DEBUG (?:?) - Save part 'docProps/core.xml'
[20:13:05,005]DEBUG (?:?) - Save part 'xl/sharedStrings.xml'
[20:13:05,005]DEBUG (?:?) - Save part 'xl/styles.xml'
[20:13:05,005]DEBUG (?:?) - Save part 'xl/workbook.xml'
[20:13:05,005]DEBUG (?:?) - Save part 'xl/worksheets/sheet1.xml'
Linux . !
Edit3
, ?
System.setProperty("org.apache.poi.util.POILogger", "org.apache.poi.util.SystemOutLogger" );
String tmpDir = System.getProperty("java.io.tmpdir")+File.separator+"excelfiles";
ExcelFileCreationStrategy tfcs = new ExcelFileCreationStrategy();
try {
tfcs.createTempDirectory(tmpDir);
} catch (IOException e) {
e.printStackTrace();
LOG.error(e);
}
TempFile.setTempFileCreationStrategy(tfcs);
final SXSSFWorkbook workbook = new SXSSFWorkbook();
workbook.setCompressTempFiles(true);
LOG.debug("creating work sheet - next line fails");
Sheet sheet = workbook.createSheet();
LOG.debug("It worked!!!!");