We are using the Aspose components in an application running on WebSphere Application Server 7 for Windows. At some point conversion to TIFF stops working in the PDF converter.
If we call the converter in a loop, it works well for 20 to 30 conversions, and then a null pointer exception is thrown. After that the same null pointer exception is thrown on every conversion, and we have to restart the application to convert any PDF file.
We have tried with different pdf files, and it seems to occur using any PDF file no matter the size of the files.
Code for converter is:
PdfConverter pdfConverter = new PdfConverter();
try {
pdfConverter.setResolution(new Resolution(300));
pdfConverter.bindPdf(inputFilestream);
pdfConverter.doConvert();
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.setCompression(CompressionType.LZW);
pdfConverter.saveAsTIFF(outputFilename, tiffSettings);
} finally {
pdfConverter.close();
}
Exception from component is:
Caused by: java.lang.NullPointerException
at com.aspose.ms.System.j.b(Unknown Source)
at com.aspose.ms.System.j.a(Unknown Source)
at com.aspose.ms.System.j.sort(Unknown Source)
at com.aspose.ms.System.j.sort(Unknown Source)
at com.aspose.ms.c.g.bf.a(Unknown Source)
at com.aspose.ms.c.g.b.writeToSequence(Unknown Source)
at com.aspose.ms.core.a.a.b.a.a(Unknown Source)
at com.aspose.ms.System.d.b.a(Unknown Source)
at com.aspose.ms.System.d.aa.a(Unknown Source)
at com.aspose.pdf.b.k.b.c.m.o(Unknown Source)
at com.aspose.pdf.devices.TiffDevice.processInternal(Unknown Source)
at com.aspose.pdf.devices.DocumentDevice.process(Unknown Source)
at com.aspose.pdf.facades.PdfConverter.a(Unknown Source)
at com.aspose.pdf.facades.PdfConverter.saveAsTIFF(Unknown Source)
We are using version 9.0 of PDF component, but nullpointer exception also occurs when using v9.1 and v4.5.1.
We have also tried:
- using com.aspose.pdf.devices.DocumentDevice.process method for conversion
- raising heap memory allocation
All with null pointer exception at some point.
The same pattern occurs when using Imaging v2.1:
Code for converter is:
Image image = Image.load(inputFilestream);
TiffOptions options = new TiffOptions();
options.setCompression(TiffCompressions.Lzw);
options.setPhotometric(TiffPhotometrics.Rgb);
int[] s = {8, 8, 8};
options.setBitsPerSample(s);
image.save(outputFilename, options);
A nullpointer exception is thrown after about 30 successful conversions, and after that no images can be converted without nullpointer exception.
Caused by: java.lang.NullPointerException
at com.aspose.imaging.internal.ms.System.c.b(Unknown Source)
at com.aspose.imaging.internal.ms.System.c.a(Unknown Source)
at com.aspose.imaging.internal.ms.System.c.a(Unknown Source)
at com.aspose.imaging.internal.ms.System.c.b(Unknown Source)
at com.aspose.imaging.fileformats.tiff.TiffFrame.save(Unknown Source)
at com.aspose.imaging.internal.bz.p.export(Unknown Source)
… 81 more
Do you have suggestions, what could cause the nullpointer exceptions?
Hi Jan,
Hi Tilal,
Thanks for your reply.
No multithreaded approach is used. But now I did testing using different JREs, and the exception was only produced on the WebSphere JRE. The WebSphere JRE used is from WebSphere 7.0.0.31 64bit for Windows. (31 is most recent fixpack)
The exception occurs every time in the following loop no matter which pdf file is used.
for (int x=0;x<50;x++) {
PdfConverter pdfConverter = new PdfConverter();
try {
pdfConverter.setResolution(new Resolution(300));
pdfConverter.bindPdf(“C:/temp/1.pdf”);
pdfConverter.doConvert();
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.setCompression(CompressionType.LZW);
pdfConverter.saveAsTIFF(“C:/temp/1.tif”, tiffSettings);
} finally {
pdfConverter.close();
}
}
Hi Jan,
Hi Jan,
Hi,
Thanks for your reply. WebSphere 7 is running Java 6 and not the Java 7 in your reply. I have attached image with version information. For now I have continued to test on our AIX test environment, as the solution we are building is for an AIX environment, and this problem only occurs on Windows. So it is not critical to us. When I have time, I will try it on another Windows machine to verify, and return the result to you.
Best regards
Hi Jan,