Skip to Content

NullPointerException in OpenTypeFontManager

I'm getting an NPE when printing a report to pdf

2018-11-01 14:29:42,392 ERROR com.businessobjects.reports.sdk.JRCCommunicationAdapter [qtp79290965-21] (SourceFile:719) -  detected an exception: java.lang.NullPointerExceptionat com.crystaldecisions.reports.exporters.format.page.pdf.fontembedding.opentype.OpenTypeFontManager.a(SourceFile:384)
 at com.crystaldecisions.reports.exporters.format.page.pdf.fontembedding.opentype.OpenTypeFontManager.do(SourceFile:259)
 at com.crystaldecisions.reports.exporters.format.page.pdf.fontembedding.opentype.OpenTypeFontManager.if(SourceFile:77)
 at com.crystaldecisions.reports.exporters.format.page.pdf.fontembedding.FontEmbeddingSession.if(SourceFile:113)
 at com.crystaldecisions.reports.exporters.format.page.pdf.fontembedding.FontEmbeddingSession.a(SourceFile:104)
 at com.crystaldecisions.reports.exporters.format.page.pdf.pdflib.r.if(SourceFile:594)
 at com.crystaldecisions.reports.exporters.format.page.pdf.pdflib.r.a(SourceFile:424)
 at com.crystaldecisions.reports.exporters.format.page.pdf.pdflib.PdfDocumentManager.a(SourceFile:337)
 at com.crystaldecisions.reports.exporters.format.page.pdf.dom.a.a(SourceFile:1584)
 at com.crystaldecisions.reports.exporters.format.page.pdf.dom.a.a(SourceFile:1492)
 at com.crystaldecisions.reports.exporters.format.page.pdf.dom.a.a(SourceFile:780)
 at com.crystaldecisions.reports.exporters.format.page.pdf.dom.a.a(SourceFile:729)
 at com.crystaldecisions.reports.exporters.format.page.pdf.dom.a.a(SourceFile:683)
 at com.crystaldecisions.reports.exporters.format.page.pdf.dom.a.a(SourceFile:2114)
 at com.crystaldecisions.reports.exporters.format.page.pdf.dom.d.if(SourceFile:1829)
 at com.crystaldecisions.reports.exporters.format.page.pdf.dom.d.int(SourceFile:1821)
 at com.crystaldecisions.reports.exporters.format.page.pdf.dom.d.a(SourceFile:455)
 at com.crystaldecisions.reports.exporters.format.page.pdf.dom.d.a(SourceFile:304)
 at com.crystaldecisions.reports.exporters.format.page.pdf.dom.d.a(SourceFile:283)
 at com.crystaldecisions.reports.exporters.format.page.pdf.dom.d.a(SourceFile:283)
 at com.crystaldecisions.reports.exporters.format.page.pdf.dom.b.a(SourceFile:217)
 at com.crystaldecisions.reports.exporters.format.page.pdf.dom.PdfAdvancedDocumentModeller.a(SourceFile:177)
 at com.crystaldecisions.reports.exporters.page.pdf.AdobePDFExporter.a(SourceFile:252)
 at com.crystaldecisions.reports.exporters.page.pdf.AdobePDFExporter.processFormattedContent(SourceFile:200)
 at com.crystaldecisions.reports.formatter.export2.a.a(SourceFile:105)
 at com.crystaldecisions.reports.formatter.export2.a.a(SourceFile:253)
 at com.crystaldecisions.reports.formatter.export2.ExportSupervisorEx.if(SourceFile:646)
 at com.crystaldecisions.reports.formatter.export2.ExportSupervisorEx.a(SourceFile:597)
 at com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.a(SourceFile:641)
 at com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.int(SourceFile:677)
 at com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(SourceFile:1943)
 at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:660)
 at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(SourceFile:166)
 at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(SourceFile:528)
 at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(SourceFile:525)
 at com.crystaldecisions.reports.common.ThreadGuard.syncExecute(SourceFile:102)
 at com.businessobjects.reports.sdk.JRCCommunicationAdapter.for(SourceFile:524)
 at com.businessobjects.reports.sdk.JRCCommunicationAdapter.int(SourceFile:423)
 at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(SourceFile:351)
 at com.businessobjects.sdk.erom.jrc.a.a(SourceFile:54)
 at com.businessobjects.sdk.erom.jrc.a.execute(SourceFile:67)
 at com.crystaldecisions.proxy.remoteagent.RemoteAgent$a.execute(SourceFile:716)
 at com.crystaldecisions.proxy.remoteagent.CommunicationChannel.a(SourceFile:125)
 at com.crystaldecisions.proxy.remoteagent.RemoteAgent.a(SourceFile:537)
 at com.crystaldecisions.sdk.occa.report.application.dt.a(SourceFile:186)
 at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(SourceFile:1558)
 at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(SourceFile:337)
 at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.if(SourceFile:224)
 at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:148)
 at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:129)
 at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:112)

Running on alpine openjdk 1.8.0_171 (within Docker)

crjava 12.2.224

I have tried copying the $JAVA_HOME/lib/fonts dir from an Oracle JRE into this jre but that caused a different issue:

"Page Area too large"

Any tips?

EDIT:

fixed by installing windows fonts and copying them to java dir

apk add --no-cache msttcorefonts-installer && update-ms-fonts && fc-cache -f && ln -s /usr/share/fonts/truetype/msttcorefonts /usr/lib/jvm/default-jvm/jre/lib/fonts
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Dec 17, 2018 at 09:50 PM

    Hi David,

    Thank you for posting the answer when you found it. That will save future users a lot of aggravation if they encounter the same issue.

    Shawn

    Note: Re-pasting solution as detailed by original poster:

    -Install windows fonts and copy them to java directory

    apk add--no-cache msttcorefonts-installer &&update-ms-fonts && fc-cache -f && ln -s /usr/share/fonts/truetype/msttcorefonts /usr/lib/jvm/default-jvm/jre/lib/fonts
    Add comment
    10|10000 characters needed characters exceeded

  • Aug 13 at 12:28 PM

    Hello! Just an update in case it might help anyone else...

    I also ran into a similar NPE in JRCCommunicationAdapter with Windows 10 while using AdoptOpenJDK 8. The particular report used Arial font everywhere and displayed fine in the reports viewer, but the NPE occurred when trying to export to PDF.

    After some experimentation, a workaround was to create the fonts folder in the AdoptOpenJDK JRE (jre\lib\fonts) and copy a single font file from the Linux msttcorefonts mentioned above into the newly created fonts folder. My document uses all Arial font, but it doesn't seem to matter what font file is in the fonts folder. I copied Webdings.ttf. The file does have to be a real font file. I tried making a dummy text file and rename it to Webdings.ttf, but the NPE occurred with the dummy font file.

    Once a real font is copied to jre\lib\fonts, The PDF is created just fine with the Arial font embedded. It seems that there just has to be a one real font at jre\lib\fonts to get started, and then crjava/AdoptOpenJDK will eventually use fontconfig to find the correct Windows font.

    Add comment
    10|10000 characters needed characters exceeded