Forum Stats

  • 3,769,647 Users
  • 2,252,997 Discussions
  • 7,875,135 Comments

Discussions

Null Pointer Exception at sun.awt.X11FontManager.getFontPath(X11FontManager.java)

Trying to look for any clues on a simple Graphics code which is reporting Null Pointer Exception with the stack below :

java.lang.NullPointerException

    at sun.awt.X11FontManager.getFontPath(X11FontManager.java)

    at sun.font.SunFontManager.getPlatformFontPath(SunFontManager.java)

    at sun.awt.X11FontManager.getFileNameFromPlatformName(X11FontManager.java)

    at sun.font.SunFontManager.initCompositeFonts(SunFontManager.java)

    at sun.font.SunFontManager.access$700(SunFontManager.java)

    at sun.font.SunFontManager$2.run(SunFontManager.java)

    at java.security.AccessController.doPrivileged(Native Method)

    at sun.font.SunFontManager.<init>(SunFontManager.java)

    at sun.awt.FcFontManager.<init>(FcFontManager.java)

    at sun.awt.X11FontManager.<init>(X11FontManager.java)

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java)

    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java)

    at java.lang.reflect.Constructor.newInstance(Constructor.java)

    at java.lang.Class.newInstance(Class.java)

    at sun.font.FontManagerFactory$1.run(FontManagerFactory.java)

    at java.security.AccessController.doPrivileged(Native Method)

    at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java)

    at java.awt.Font.getFont2D(Font.java)

    at java.awt.Font.defaultLineMetrics(Font.java)

    at java.awt.Font.getLineMetrics(Font.java)



"sun.awt.X11FontManager.getFontPath" is defined on X11FontManager.java which is available here :

http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/7eae7c89dab4/src/solaris/classes/sun/awt/X11FontManager.java


This is on AIX with Java version :

java version "1.8.0_191"

Java(TM) SE Runtime Environment (build 8.0.5.27 - pap6480sr5fp27-20190104_01(SR5 FP27))

IBM J9 VM (build 2.9, JRE 1.8.0 AIX ppc64-64-Bit Compressed References 20181219_405297 (JIT enabled, AOT enabled)

OpenJ9 - 3f2d574

OMR   - 109ba5b

IBM   - e2996d1)

JCL - 20190104_01 based on Oracle jdk8u191-b26


Sample program to recreate this error is attached. We compile and run this within the Oracle database , however something similar from the command line also reports the same stack.

We have checked DISPLAY is not set , this is a HeadLess environment and the Font packages are installed.


This appears to be an environment specific issue as the same code appears to be working on other AIX boxes with an similar JDK setup.

Would appreciate any pointers / things to check to get past this Null Pointer exception