I'm using a multi-threaded process to create PDF documents from word templates. After a few successful conversions, the Docx.toFO call gives the below error. Kindly help me through this.
- Code: Select all
org.docx4j.openpackaging.exceptions.Docx4JException: Exception exporting package
at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:96)
at org.docx4j.Docx4J.toFO(Docx4J.java:467)
at com.templateMerger.TemplateMergerUtil.saveToPDF(TemplateMergerUtil.java:232)
at com.templateMerger.TemplateMergerUtil.mergeToTemplate(TemplateMergerUtil.java:200)
at com.templateMerger.TemplateProcessor.run(TemplateProcessor.java:213)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:896)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:735)
Caused by: java.lang.NullPointerException
at java.util.AbstractList$SimpleListIterator.hasNext(Unknown Source)
at org.apache.fop.fonts.truetype.TTFFile.readKerning(TTFFile.java:1678)
at org.apache.fop.fonts.truetype.TTFFile.readFont(TTFFile.java:730)
at org.apache.fop.fonts.truetype.TTFFontLoader.read(TTFFontLoader.java:105)
at org.apache.fop.fonts.truetype.TTFFontLoader.read(TTFFontLoader.java:91)
at org.apache.fop.fonts.FontLoader.getFont(FontLoader.java:205)
at org.apache.fop.fonts.FontLoader.loadFont(FontLoader.java:154)
at org.apache.fop.fonts.LazyFont.load(LazyFont.java:151)
at org.apache.fop.fonts.LazyFont.hasChar(LazyFont.java:210)
at org.apache.fop.fonts.Font.hasChar(Font.java:261)
at org.apache.fop.fonts.FontSelector.selectFontForCharacter(FontSelector.java:46)
at org.apache.fop.fonts.FontSelector.selectFontForCharacterInText(FontSelector.java:84)
at org.apache.fop.layoutmgr.inline.TextLayoutManager.initialize(TextLayoutManager.java:235)
at org.apache.fop.layoutmgr.AbstractLayoutManager.getChildLM(AbstractLayoutManager.java:119)
at org.apache.fop.layoutmgr.BreakOpportunityHelper.getBreakBefore(BreakOpportunityHelper.java:45)
at org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager.getBreakBefore(InlineStackingLayoutManager.java:392)
at org.apache.fop.layoutmgr.BreakOpportunityHelper.getBreakBefore(BreakOpportunityHelper.java:49)
at org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager.getBreakBefore(InlineStackingLayoutManager.java:392)
at org.apache.fop.layoutmgr.BreakOpportunityHelper.getBreakBefore(BreakOpportunityHelper.java:49)
at org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager.getBreakBefore(InlineStackingLayoutManager.java:392)
at org.apache.fop.layoutmgr.BreakOpportunityHelper.getBreakBefore(BreakOpportunityHelper.java:49)
at org.apache.fop.layoutmgr.BlockStackingLayoutManager.addKnuthElementsForBreakBefore(BlockStackingLayoutManager.java:1038)
at org.apache.fop.layoutmgr.BlockStackingLayoutManager.breakBeforeServed(BlockStackingLayoutManager.java:443)
at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:253)
at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:113)
at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:105)
at org.apache.fop.layoutmgr.table.TableCellLayoutManager.getNextKnuthElements(TableCellLayoutManager.java:153)
at org.apache.fop.layoutmgr.table.RowGroupLayoutManager.createElementsForRowGroup(RowGroupLayoutManager.java:120)
at org.apache.fop.layoutmgr.table.RowGroupLayoutManager.getNextKnuthElements(RowGroupLayoutManager.java:63)
at org.apache.fop.layoutmgr.table.TableContentLayoutManager.getKnuthElementsForRowIterator(TableContentLayoutManager.java:228)
at org.apache.fop.layoutmgr.table.TableContentLayoutManager.getNextKnuthElements(TableContentLayoutManager.java:181)
at org.apache.fop.layoutmgr.table.TableLayoutManager.getNextKnuthElements(TableLayoutManager.java:253)
at org.apache.fop.layoutmgr.FlowLayoutManager.getNextChildElements(FlowLayoutManager.java:221)
at org.apache.fop.layoutmgr.FlowLayoutManager.addChildElements(FlowLayoutManager.java:145)
at org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:114)
at org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:67)
at org.apache.fop.layoutmgr.PageBreaker.getNextKnuthElements(PageBreaker.java:222)
at org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.java:673)
at org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:155)
at org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:137)
at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:387)
at org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:90)
at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:113)
at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:267)
at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:128)
at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:347)
at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:181)
at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Unknown Source)
at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.render(FORendererApacheFOP.java:211)
at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.render(FORendererApacheFOP.java:158)
at org.docx4j.convert.out.fo.AbstractFOExporter.postprocess(AbstractFOExporter.java:139)
at org.docx4j.convert.out.fo.AbstractFOExporter.postprocess(AbstractFOExporter.java:47)
at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:81)
... 7 more