fontconfig, Java, and Domino 11

Fri Jan 29 12:09:35 EST 2021

Tags: java
  1. AbstractCompiledPage, Missing Plugins, and MANIFEST.MF in FP10 and V10
  2. Domino 11's Java Switch Fallout
  3. fontconfig, Java, and Domino 11
  4. Notes/Domino 12.0.2 Fallout
  5. Notes/Domino 14 Fallout

In my last post, I quickly mentioned some trouble I had run into with fontconfig and Poi, in the context of configuring a Docker-based Domino server. However, I think it deserves its own post, so I have something to point to if others run into the same trouble down the line.

The Upshot

The upshot of the issue is that, if you're going to use Poi or or other graphics-adjacent Java libraries in Domino 11 on Linux, you'll need fontconfig and potentially some other support files installed on your system. If you have any GUI stuff installed, they'll probably be there, but it's common for them to be missing on headless servers.

For the official Domino Docker image, which uses Red Hat's package system, I wrote this Dockerfile for my derivative version:

FROM domino-docker:V1101FP2_10202020prod
USER root
RUN yum install --assumeyes fontconfig urw-fonts
USER notes

On Debian-based systems, I believe you just need apt install fontconfig.

The Details

AdoptOpenJDK builds of Java apparently don't include the same font-related support files that the Oracle ones did, and that results in calls made to the AWT layer to throw NullPointerExceptions at various times related to getting font information. This has shown up in a couple issues over in the openjdk-support project on GitHub, with two representative ones being:

https://github.com/AdoptOpenJDK/openjdk-support/issues/80

java.lang.NullPointerException
  at sun.awt.FcFontManager.getDefaultPlatformFont(FcFontManager.java:76)
  at sun.font.SunFontManager$2.run(SunFontManager.java:433)
  ...

https://github.com/AdoptOpenJDK/openjdk-build/issues/693

java.lang.NullPointerException
  at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)
  at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:219)
  at sun.awt.FontConfiguration.init(FontConfiguration.java:107)
  ...

Domino 11 switched from IBM's proprietary variant of J9 to OpenJ9, and this is another one of the little fiddly details that isn't quite the same between the two.

Most commonly, I've found this crop up when using Poi, specifically calling autosizeColumns when generating a spreadsheet, but in theory any number of things like that will trip across this. Unfortunately, the internal JVM classes aren't terribly helpful in their error reporting, since they get several method calls in just assuming that all is well with the world before bailing with the NPEs like above.

It's a mild annoyance to deal with, but fortunately one with a straightforward fix, at least once you know what the trouble is.

Commenter Photo

tommaso - Mon May 03 13:12:01 EDT 2021

Hi, I'm running Domino 11FP2 on CentOS 8 .

with the Poi sheet.autoSizeColumn function I experienced exactly the java.lang.NullPointerException at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)

error even avter installing fontconfig urw-fonts

Than I tried (after this : https://github.com/adoptium/adoptium-support/issues/70) providing a fontconfig.properties and the error changed to

java.lang.NullPointerException at sun.awt.FcFontManager.getDefaultPlatformFont(FcFontManager.java:76)

Can you suggest something? thanks a lot tommaso

Commenter Photo

Jesse Gallagher - Mon May 10 12:54:45 EDT 2021

Hmm, that's odd - the fontconfig/urw-fonts route worked well for my Docker image, but I haven't run Domino on actual CentOS. Maybe there's something else to it, though it's still surprising.

Commenter Photo

Ayhan - Mon May 23 13:06:49 EDT 2022

11 years later - this helped us a lot - thanks champ

New Comment