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

Free Support Forum - aspose.com

NPE When loading Word document

Hi!

We are using aspose.words for Java to convert different file formats to PDF/A1b in an applicaiton running on JBoss EAP 6.1
Some Word documents consistently gives a NullPointerException, like this:
Caused by: java.lang.NullPointerException
at com.aspose.words.zz2A.zzZN6(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zz2A.zzZNb(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zz2B.zzB(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zz2B.zzZNp(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zz2B.zzT(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zz2H.zzQ(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zz2H.zzX(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zzWN.zzZ(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zzZIH.zzZnh(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zzZIH.zzZ(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zzZQF.zzX(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zzZQF.zzy(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zzZGU.zzSY(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zzC1.zzX(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zzZQW.zzS(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zzZQF.zzy(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zzZGU.zzSY(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zzO2.zzY6(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zzO3.zzZ(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zzO3.zzaG(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zz3K.zzZ(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.Document.updatePageLayout(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.Document.zzYa(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.Document.zzbm(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.Document.getPageCount(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zzDJ.zzY(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.zzDJ.zzZ(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.Document.zzZ(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.Document.zzZ(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at com.aspose.words.Document.save(Unknown Source) [aspose-words-14.3.jar:14.3.0.0]
at se.sjv.commons.fileconversion.converter.pdfa.DocumentConverter.performConversion(DocumentConverter.java:33) [sjv-fileconversion-0.0.2-SNAPSHOT.jar:]

The method where the error occurs looks like this:

public void performConversion(final BufferedInputStream inputStream, final OutputStream outputStream)
throws ConversionException {
try {
final Document doc = new Document(inputStream);
doc.save(outputStream, getSaveOptions());
} catch (final Exception e) {
throw new ConversionException(e);
}
}

protected PdfSaveOptions getSaveOptions() {
final PdfSaveOptions options = new PdfSaveOptions();
options.setCompliance(PdfCompliance.PDF_A_1_B);
return options;
}

The document causing the above error is attached.

Hi Eddie,

Thanks for your inquiry. I have converted the shared document using the same code and have not found any issue. Please use the latest version of Aspose.Words for Java 14.4.1. I have attached the output Pdf with this post for your kind reference.

If you still face problem, please share following detail for investigation purposes.


  • OS (Windows Version or Linux Version)
  • Architecture (32 / 64 bit)
  • Java version