Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting NULL pointer exception at sun.awt.FcFontManager.getDefaultPlatformFont(FcFontManager.java:76) #80

Closed
madhu-broad opened this issue Apr 1, 2020 · 8 comments
Assignees
Labels
bug Something isn't working Waiting on OP
Milestone

Comments

@madhu-broad
Copy link

  • Platform and architecture (e.g. Linux/x64: Solaris Sparc 11.4/5 and x86 11.4/5

  • Java version (from "java --version") e.g. 1.8.0_181, 11.0.4+11 etc.: openjdk version "1.8.0_222"

  • Variant e.g. HotSpot or OpenJ9: hotspot

  • Have you tested it with other vendors' java: Oracle JRE works

  • Steps to reproduce:

  • Error messsage and/or description of what is not working as expected:

Hello,

We have a GUI application (based on java.swing), which is basically management application for enterprise servers runs on Linux and Solaris platforms. The application use to work with Oracle JDK-JRE and recently we tried with OpenJDK ((AdoptOpenJDK)(build 1.8.0_222-b10)) on Solaris platforms and the build integration went fine but while running the application it fails with 'NULL Pointer exception' at sun.awt.FcFontManager.getDefaultPlatformFont(FcFontManager.java:76) and the behaviour is the same on both Solaris x64 and Sparc servers (11.4/5 builds).

Copied below the issue for reference with the OpenJDK info..

root@dhcp-10-123-179-44:/opt/ocm# ./ocmanager
Exception in thread "main" java.lang.NullPointerException
at sun.awt.FcFontManager.getDefaultPlatformFont(FcFontManager.java:76)
at sun.font.SunFontManager$2.run(SunFontManager.java:433)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.SunFontManager.(SunFontManager.java:376)
at sun.awt.FcFontManager.(FcFontManager.java:35)
at sun.awt.X11FontManager.(X11FontManager.java:57)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:83)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
at java.awt.Font.getFont2D(Font.java:491)
at java.awt.Font.getFamily(Font.java:1220)
at java.awt.Font.getFamily_NoClientCode(Font.java:1194)
at java.awt.Font.getFamily(Font.java:1186)
at sun.swing.SwingUtilities2.displayPropertiesToCSS(SwingUtilities2.java:1478)
at javax.swing.plaf.basic.BasicHTML$BasicDocument.setFontAndColor(BasicHTML.java:366)
at javax.swing.plaf.basic.BasicHTML$BasicDocument.(BasicHTML.java:355)
at javax.swing.plaf.basic.BasicHTML$BasicEditorKit.createDefaultDocument(BasicHTML.java:311)
at javax.swing.plaf.basic.BasicHTML.createHTMLView(BasicHTML.java:54)
at javax.swing.plaf.basic.BasicHTML.updateRenderer(BasicHTML.java:207)
at javax.swing.plaf.basic.BasicLabelUI.propertyChange(BasicLabelUI.java:481)
at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
at java.awt.Component.firePropertyChange(Component.java:8434)
at javax.swing.JLabel.setText(JLabel.java:330)
at AboutOCM.initComponents(AboutOCM.java:253)
at AboutOCM.(AboutOCM.java:37)
at AboutOCM.(AboutOCM.java:26)
at HBAnyware.(HBAnyware.java:387)
at HBAnyware.run(HBAnyware.java:14244)
at EmulexHBAManager.main(EmulexHBAManager.java:14)
root@dhcp-10-123-179-44:/opt/ocm#

root@dhcp-10-123-179-44:/opt/ocm# ./jre/bin/java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.222-b10, mixed mode)
root@dhcp-10-123-179-44:/opt/ocm#

root@dhcp-10-123-179-44:/tmp# uname -a
SunOS dhcp-10-123-179-44 5.11 11.4.12.5.0 i86pc i386 i86pc
root@dhcp-10-123-179-44:/tmp#

Couple of options we tried, i.e. Verified the existence of library 'libfontconfig' and it exist. Copied below the output reference.

root@dhcp-10-123-179-44:# find /usr/lib -name font.*
/usr/lib/libfontconfig.so
/usr/lib/libfontconfig.so.1.9.2
/usr/lib/amd64/libfontconfig.so
/usr/lib/amd64/libfontconfig.so.1.9.2
/usr/lib/amd64/pkgconfig/fontconfig.pc
/usr/lib/amd64/pkgconfig/fontenc.pc
/usr/lib/amd64/libfontconfig.so.1
/usr/lib/libfontconfig.so.1
/usr/lib/tk8.6/fontchooser.tcl
/usr/lib/tk8.6/ttk/fonts.tcl
/usr/lib/tk8.6/demos/fontchoose.tcl
/usr/lib/pkgconfig/fontconfig.pc
/usr/lib/pkgconfig/fontenc.pc
/usr/lib/xorg/amd64/libfontenc.so.1
/usr/lib/xorg/amd64/libfontenc.so
/usr/lib/xorg/amd64/libfontenc.so.1.0.0
/usr/lib/xorg/libfontenc.so.1
/usr/lib/xorg/libfontenc.so.1.0.0
/usr/lib/xorg/libfontenc.so
/usr/lib/grub2/uefi64/lib/grub/x86_64-efi/font.mod
/usr/lib/grub2/bios/lib/grub/i386-pc/font.mod
root@dhcp-10-123-179-44:
#

Please note that the application still works from Oracle JDK-JRE on Solaris platforms.

After going through a few links on the net, have a couple of questions.

  1. Is it known issue (still exist) on AdoptOpenJDK-JRE-8(1.8.0_222)? If yes, Any workaround to resolve? or Any reference to the version which has the fix? or Do we need to install any system packages on Solaris 11.4/5.
  2. Again, few links says the issue is resolved on OpenJDK-JRE-11 series, But i do not see any release of these kits on Solaris platform? Any plan to release OpenJDK 11 binaries for Solaris x86 and sparc?

We are a kind of stuck at the starting itself, Highly appreciate the help..

Thanks,
Madhu

@karianna
Copy link
Contributor

karianna commented Apr 1, 2020

@madhu-broad - can you try the latest 8u242 release please?

@karianna karianna added this to Needs triage in openjdk-support via automation Apr 1, 2020
@aahlenst
Copy link
Contributor

aahlenst commented Apr 1, 2020

Related: AdoptOpenJDK/openjdk-jdk8u#6 and adoptium/temurin-build#693. Fixing #70 might fix this one, too.

@madhu-broad
Copy link
Author

@madhu-broad - can you try the latest 8u242 release please?

Tried with the latest build i.e. 8u242 but the result remains the same.

@karianna karianna moved this from Needs triage to Low priority in openjdk-support Apr 1, 2020
@karianna karianna added bug Something isn't working and removed Waiting on OP labels Apr 1, 2020
@madhu-broad
Copy link
Author

Related: AdoptOpenJDK/openjdk-jdk8u#6 and AdoptOpenJDK/openjdk-build#693. Fixing #70 might fix this one, too.

Any milestone/tentative date for fix? This helps us for our planning.

@aahlenst
Copy link
Contributor

aahlenst commented Apr 6, 2020

@madhu-broad Please watch #70. I plan to bring the topic up in this week's TSC call. We didn't get to it last week. Then maybe we have an idea what's to do and how long it might take.

@aahlenst
Copy link
Contributor

Closing because it's a duplicate of #70.

openjdk-support automation moved this from Low priority to Closed May 30, 2020
@aahlenst aahlenst added the duplicate This issue or pull request already exists label May 30, 2020
@karianna karianna added this to the May 2020 milestone May 30, 2020
@aahlenst aahlenst reopened this Dec 13, 2020
openjdk-support automation moved this from Closed to Needs triage Dec 13, 2020
@aahlenst
Copy link
Contributor

@madhu-broad I just tested with 8u275 on Solaris 11.4/x64 and there's nothing to install. The following test program printed a bunch of fonts:

import java.awt.*;

public class FontTest {

    public static void main(String[] args) {

        String[] names = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();

        System.out.println("Found " + names.length + " fonts:");

        for (String name : names) {

            System.out.println(name);
        }
    }
}

So, if you get some fonts, too, then the basic font integration works okay. The Emulex tool might be requesting a font that isn't installed, so looking into an old Oracle JDK for fonts and copying them over might work. I couldn't find a download for the Emulex tool, so I cannot test myself.

If you want to test with OpenJDK 11, you can grab a download from BellSoft: https://bell-sw.com/pages/downloads/#/java-11-lts. If that works for you, great. For testing purposes, trying an Oracle JDK 8 from https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html shouldn't hurt, either.

@aahlenst aahlenst added Waiting on OP and removed duplicate This issue or pull request already exists labels Dec 13, 2020
@karianna karianna moved this from Needs triage to Closed in openjdk-support Dec 15, 2020
@aahlenst
Copy link
Contributor

Closing due to lack of requested feedback. We're happy to reopen the issue if feedback is provided by the OP (or anybody else) at a later date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Waiting on OP
Projects
No open projects
openjdk-support
  
Closed
Development

No branches or pull requests

3 participants