Free Support Forum - aspose.com

ExceptionInInitializerError from PdfExtractor.extractText()

I am trying to read in some PDFs, via the PdfExtractor, in an OSGi environment, but getting an exception.


Here is the code that uses the PdfExtractor:

ByteArrayOutputStream out = new ByteArrayOutputStream();
PdfExtractor extractor = new PdfExtractor();
extractor.bindPdf(new FileInputStream(file));
extractor.extractText();
extractor.getText(out);
extractor.close();

But I get the following exception:

java.lang.ExceptionInInitializerError
at com.aspose.pdf.kit.pw.(Unknown Source)
at com.aspose.pdf.kit.PDFont.getEncoding(Unknown Source)
at com.aspose.pdf.kit.PDFont.encode(Unknown Source)
at com.aspose.pdf.kit.n5.a(Unknown Source)
at com.aspose.pdf.kit.f6.a(Unknown Source)
at com.aspose.pdf.kit.n5.a(Unknown Source)
at com.aspose.pdf.kit.n5.a(Unknown Source)
at com.aspose.pdf.kit.n5.if(Unknown Source)
at com.aspose.pdf.kit.n5.a(Unknown Source)
at com.aspose.pdf.kit.i1.a(Unknown Source)
at com.aspose.pdf.kit.i1.a(Unknown Source)
at com.aspose.pdf.kit.i1.a(Unknown Source)
at com.aspose.pdf.kit.h8.a(Unknown Source)
at com.aspose.pdf.kit.PdfExtractor.extractText(Unknown Source)
Caused by: java.lang.NullPointerException
at java.io.Reader.(Reader.java:61)
at java.io.InputStreamReader.(InputStreamReader.java:55)
at com.aspose.pdf.kit.rm.(Unknown Source)
… 25 more


This issue and stack trace look like they may be similar to the one in this thread: http://www.aspose.com/community/forums/242110/exception-using-pdfconvert-to-create-png-from-pdf/showthread.aspx#242110

Any idea on how I can get this working?

Thanks!

Hi Geoffrey,

Please share the input PDF file causing this problem, so we could test the issue at our end. You’ll be updated with the results accordingly.

We’re sorry for the inconvenience.
Regards,

Thank you for the quick response!


I seem to be getting the issue with any PDF I try. I’ve attached one such example.

Thanks!

Hi Geoffrey,

Thank you for sharing the sample PDF file. We need to investigate this issue in detail at our end. Please spare us some time and you’ll be updated with the results accordingly.

We’re sorry for the inconvenience and appreciate your patience.
Regards,

Hi Geoffrey,

I have tested the issue using the latest version and a simple Java application, but couldn’t notice any such problem. Please share the details of your working environment. Also, if you’re not using the latest version (3.3.0) then please download it from this link and try at your end.

We’re sorry for the inconvenience and looking forward to help you out.
Regards,

Thank you again for your response!


I am able to get it to work in a simple Java environment too. The problem I am running into is when I am using it in an OSGi environment. Typically, such issues are because of ClassLoader differences in OSGi and I was hoping you might have insight into what might be failing under such circumstances, given the stack trace.

Thanks!

Hi Geoffrey,

We have already logged a related issue as PDFKITJAVA-17996 in our issue tracking system. This issue will be resolved in our upcoming monthly release due at the end of this month - September 2010. You’ll be notified via this forum thread. Please download the latest version once it is published and try at your end.

If you find any further questions, please do let us know.
Regards,

Fantastic! Thank you for your help!

The issues you have found earlier (filed as 17996) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Fantastic! That does seem to solve our problem.


Thank you for your prompt responses and fix!