We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

New Workbook fails to open inputstream

Hi ,

We are using the following code to open and read a excel file. this code has been working for a long time on a linux server. recently we have changed our build process to deploy using UCD, UCD seems to inject additional the environment variables in to our JVM application.

Issue is following code "new Workbook(excelFileStream)" stops responding and execution is hang in this line and JVM never responds to any of our excel processing request. want to understand what could be causing this issue. If i start the same code base manually everything just works fine.

inputfilestream could be sometime referring to the template excel file from one of the application jar file. sometime it could refer to the temporary file that user uploads. let me know if you need any additional details. this is one of the critical functionality with out which we are struck with the old build process.

Linux : x86_64 x86_64 x86_64 GNU/Linux
private void readExcel() {
try {
if (file != null) {
FileFormatInfo fileFormat = FileFormatUtil.detectFileFormat(file.getAbsolutePath());
if (fileFormat.getFileFormatType() == FileFormatType.EXCEL_95) {
throw new AsposeException("This is Excel 95 format file which is not supported. please use Excel 97 and higher formats.");
}
passwordProtected = fileFormat.isEncrypted();
String detectedExtension = FileFormatUtil.loadFormatToExtension(fileFormat.getLoadFormat());
if (detectedExtension != null) {
this.extension = detectedExtension;
}
}
workbook = new Workbook(excelFileStream);
//Set the Formula Calculation Mode to AUTOMATIC.
workbook.getSettings().setCalcMode(CalcModeType.AUTOMATIC);
} catch (CellsException e) {
throw new AsposeException("File format not supported, please use Excel 97 and higher formats.", e);
} catch (Exception e) {
LOGGER.debug(e.getMessage());
throw new AsposeException("Error reading excel file", e);
}
}

we are using “aspose-cells” % “8.7.0” version of the jar.

Hi,


Thanks for providing us some details.

I think your issue might not be relevant to Aspose.Cells APIs as you are getting this problem after installing/deploying ucd (urbancode deploy) on linux. To confirm this, you may try to read the file using java.io package APIs only and without involving Aspose.Cells for Java to evaluate if you are getting the same issue or not.

Thank you.

Other IO operation like log file creations and reading properties from a file which is also part of the jar are working. we had issues in creating temporary files when deployed using UCD which we resolved by supplying a Djava.io.tmpdir=/tmp/ JVM argument. is there any similar property thats used by aspose internaly while loading the file in to the memory.

<o:p></o:p>

Hi,

Thanks for using Aspose.Cells.

Please try to read the file stream into ByteArrayInputStream first and then build the workbook from this memory stream to see whether the issue persists. Also, you can try to build the workbook from the file(new Workbook(String)) directly to see whether it can make any difference.