Hello,
I’m using aspose.words to fill a document with mailmerge.
It works perfectly except in a single machine running linux on PowerPc using openjdk. I get this error randomly but very often:
java.lang.NullPointerException
at com.aspose.words.zzZFG.flush(Unknown Source)
at com.aspose.words.zzYUG.zza(Unknown Source)
at com.aspose.words.zz8R.zzG(Unknown Source)
at com.aspose.words.zz8S.zzZGE(Unknown Source)
at com.aspose.words.zzZ5T.zzYTl(Unknown Source)
at com.aspose.words.Document.updatePageLayout(Unknown Source)
at com.aspose.words.zz3U.zzZAp(Unknown Source)
at com.aspose.words.zz3V.zzFi(Unknown Source)
at com.aspose.words.zz0S.zzY5(Unknown Source)
at com.aspose.words.zz0S.zzZuv(Unknown Source)
at com.aspose.words.zzZHW.zzZ7V(Unknown Source)
at com.aspose.words.zzZHW.zzZ(Unknown Source)
at com.aspose.words.MailMerge.zzZ(Unknown Source)
at com.aspose.words.MailMerge.executeWithRegions(Unknown Source)
Which can be the root cause?
The docx to fill is small: about 30Kb. My steps are very basic:
Documet pDOCUMENT = new Document(w_FULL_PATH_TEMPLATE);
DataSet pDataSet = fillDataSet();
pDOCUMENT.getMailMerge().setFieldMergingCallback( new HandleMergeImageFieldFromBlob() );
pDOCUMENT.getMailMerge().executeWithRegions(pDataSet);
I add that:
The problem occurs if I comment out the .setFieldMergingCallback line as well
Once the problem occurs I have to restart the web application in order to make the executeWithRegions call. Just as the errors put the library in a “dirty” state
@onof80 Could you please attach your template and sample data that will allow us to reproduce the issue? We will investigate the problem and provide you more information.
Anyway I get the same error with the 21.12 version, with slight different stack trace:
java.lang.NullPointerException
at com.aspose.words.zzYvM.flush(Unknown Source)
at com.aspose.words.zzWY6.zzZcq(Unknown Source)
at com.aspose.words.zzZ9A.zzZqK(Unknown Source)
at com.aspose.words.zzZ9A.zzZo9(Unknown Source)
at com.aspose.words.zzXc9.zzZaS(Unknown Source)
at com.aspose.words.zzXF7.zzYzS(Unknown Source)
at com.aspose.words.zzWY6.zzZcq(Unknown Source)
at com.aspose.words.zzWvZ.zzYzS(Unknown Source)
at com.aspose.words.zzYfF.zzZp8(Unknown Source)
at com.aspose.words.zzYfF.zzUH(Unknown Source)
at com.aspose.words.zzZ9c.zzYVX(Unknown Source)
at com.aspose.words.Document.updatePageLayout(Unknown Source)
It doesn’t occur systematically, but after a number of execution.
I’m now running just the following code, similar to yours, in a web application servlet in tomcat 9, and I get the error after a random number of calls.
I wonder why the error occurs in the flush function. Is it involved in cleaning the java.io.tmpdir files ?
Document doc = new Document(TPLPATH);
DataSet pDataSet = new DataSet();
doLog("Executing.. ");
doc.getMailMerge().executeWithRegions(pDataSet);
doc.save(SAFEFOLDER);
doLog("Saved in " + SAFEFOLDER);
The error is:
java.lang.NullPointerException
at com.aspose.words.zzYvM.flush(Unknown Source)
at com.aspose.words.zzWY6.zzZcq(Unknown Source)
at com.aspose.words.zzZ9A.zzZqK(Unknown Source)
at com.aspose.words.zzZ9A.zzZo9(Unknown Source)
at com.aspose.words.zzXc9.zzZaS(Unknown Source)
at com.aspose.words.zzXF7.zzYzS(Unknown Source)
at com.aspose.words.zzWY6.zzZcq(Unknown Source)
at com.aspose.words.zzWvZ.zzYzS(Unknown Source)
at com.aspose.words.zzYfF.zzZp8(Unknown Source)
at com.aspose.words.zzYfF.zzUH(Unknown Source)
at com.aspose.words.zzZ9c.zzYVX(Unknown Source)
at com.aspose.words.Document.updatePageLayout(Unknown Source)
at com.aspose.words.zzWlQ.zzVUt(Unknown Source)
at com.aspose.words.zzhL.zzYuK(Unknown Source)
at com.aspose.words.zzWU9.zza9(Unknown Source)
at com.aspose.words.zzWU9.zzZqK(Unknown Source)
at com.aspose.words.zzWU9.zzZp8(Unknown Source)
at com.aspose.words.zzWU9.zz8Y(Unknown Source)
at com.aspose.words.Document.zzWBq(Unknown Source)
at com.aspose.words.Document.zzZqK(Unknown Source)
at com.aspose.words.Document.zzZp8(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
at hira_ftestasposeR.Page_1(hira_ftestasposeR.java:136)
@onof80 Thank you for additional information. I have logged the issue as WORDSJAVA-2676. Our Java developers will deeply investigate the problem. Once analysis of the issue is done, we will provide you more information.
@onof80 We have completed analyzing the issue. It looks like a random issue in multithread environment + saving document to the single file: doc.save("C:\\Temp\\out.pdf"); + Exception in a flush() method. Could you please try incrementing the output file name for every saving.
@onof80 The issue has been closed as not a bug. This is a random issue in multithread environment + saving document to the single file: doc.save("C:\\Temp\\out.pdf"); + Exception in a flush() method.
Please try incrementing the output file name for every saving to avoid the problem.
Hi alexey,
I tried but it didn’t work. I tried with a random generated file name as well.
The problem occurs to us only on powerpc architecure.
We arrived to state that we can’t use aspose words on powerpc.
And I add that the same problem, on powerpc, occurs also calling executeWithRegions, not only saving:
at com.aspose.words.zzXIL.flush(Unknown Source)
at com.aspose.words.zzV3.zzYFC(Unknown Source)
at com.aspose.words.zzVWV.zzYhn(Unknown Source)
at com.aspose.words.zzVWV.zzKW(Unknown Source)
at com.aspose.words.zzYH7.zzXUp(Unknown Source)
at com.aspose.words.zzW7K.zzZv8(Unknown Source)
at com.aspose.words.zzV3.zzYFC(Unknown Source)
at com.aspose.words.zzVSK.zzZv8(Unknown Source)
at com.aspose.words.zzYz3.zzXWH(Unknown Source)
at com.aspose.words.zzYz3.zzWxz(Unknown Source)
at com.aspose.words.zzW0z.zzW5v(Unknown Source)
at com.aspose.words.Document.updatePageLayout(Unknown Source)
at com.aspose.words.zzZ9b.zzYxD(Unknown Source)
at com.aspose.words.zzYws.zzVVw(Unknown Source)
at com.aspose.words.zzYHL.zzWeP(Unknown Source)
at com.aspose.words.zzYHL.zzZiW(Unknown Source)
at com.aspose.words.zzYMo.zzZYi(Unknown Source)
at com.aspose.words.zzYMo.zzXWH(Unknown Source)
at com.aspose.words.MailMerge.zzXWH(Unknown Source)
at com.aspose.words.MailMerge.executeWithRegions(Unknown Source)
This issue has been logged as WORDSJAVA-2833. We will keep you posted and will let you know as soon as the issue is resolved. Please accept our apologies for the inconvenience.