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

Free Support Forum - aspose.com

New Workbook() => Illegal argument exception : nullPointerException

Hi,
Sometimes, when a lot of concurrent threads are executed in my Web application context, there is an exception executing new Workbook(inputFile) that is :

13:18:10,560 ERROR [stderr] (pool-40-thread-8) java.lang.IllegalArgumentException: java.lang.NullPointerException
13:18:10,564 ERROR [stderr] (pool-40-thread-8) at com.aspose.cells.a.c.zn.a(Unknown Source)
13:18:10,568 ERROR [stderr] (pool-40-thread-8) at com.aspose.cells.WorksheetCollection.U(Unknown Source)
13:18:10,570 ERROR [stderr] (pool-40-thread-8) at com.aspose.cells.WorksheetCollection.(Unknown Source)
13:18:10,574 ERROR [stderr] (pool-40-thread-8) at com.aspose.cells.Workbook.a(Unknown Source)
13:18:10,576 ERROR [stderr] (pool-40-thread-8) at com.aspose.cells.Workbook.(Unknown Source)
13:18:10,579 ERROR [stderr] (pool-40-thread-8) at com.ericsson.angusserver.export.ExportOperation.exportOp(ExportOperation.java:225)

It is not easy to reproduce it.
I try to create a program test out of my appli to highlight the problem, but without success.

The piece of incriminated code is :

FontConfigs.setFontFolder(config.getFontsPath(), false);
Workbook wb = null;
FileInputStream fisTemplate = new FileInputStream(new File(fileNameIn));
try {
wb = new Workbook(fisTemplate);
} catch (IllegalArgumentException e1){
e1.printStackTrace(); //=>
sometimes ArgumentException: NullPointerException
}

Aspose version is : aspose-cells-9.0.9.jar

Do you have any idea of what’s going on ?

To fix this problem, I call ‘new Workbook()’ function
a second time after this IllegalArgumentException and it works !!

Best regards

Hi Joëlle,


Thank you for contacting support. You’re using an old version of the Aspose.Cells for Java API. Please download and use the latest version 17.01 of Aspose.Cells for Java API and let us know how that goes on your side. You’re running multiple threads in the application, so you may missing to track the actual problematic workbook. If the problem is not reproducible, then it’ll not be possible for us to fix it.
joelle.auffret:
To fix this problem, I call ‘new Workbook()’ function a second time after this IllegalArgumentException and it works !!
Please elaborate a bit more with the help of a code example. We’re looking forward to help you.

Hi,

As you advised me, I have tried with the new version aspose-cells-17.1.0.jar. I have exactly the same problem : sometimes executing new Workbook(inputFile) fails with exception illegalArgumentException:nullPointerException.

For your information, when I comment the following line, I have no exception.
FontConfigs.setFontFolder(config.getFontsPath(), false);

Best regards

Hi Joëlle,


Thank you for the details. We recommend our clients to first set font folders (out of your concurrent threads piece of code) as below:

FontConfigs.setFontFolder(config.getFontsPath(), false);

You can then begin your concurrent threads. It should fix your issue. However, if this does not work, then we need to replicate this error on our side. Please prepare a simple console application which reproduces the error on your side and attach its zip archive in this forum thread. Please also provide fonts such as available in the specified directories. We’ll investigate and reply you appropriately. Your response is awaited.