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

java.lang.NullPointerException at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264) #560

Open
alokbaranwal opened this issue Apr 29, 2021 · 4 comments

Comments

@alokbaranwal
Copy link

alokbaranwal commented Apr 29, 2021

Hello All,
We have a Java (with JBOSS as app server) based application with GUI. While generating jasper letters from the application, we are getting exceptions in log. we dont use docker.

Env Details:-
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_282-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.282-b08, mixed mode)

cat /etc/redhat-release

Red Hat Enterprise Linux Server release 7.6 (Maipo)

There is a file fontconfig.properties available at $JAVA_HOME/lib, with below two lines in it.
version=1
sequence.allfonts=default

exception

javax.ejb.EJBException: net.sf.jasperreports.engine.JRRuntimeException: Error initializing graphic environment.
...
Caused by: net.sf.jasperreports.engine.JRRuntimeException: Error initializing graphic environment.
...
Caused by: java.lang.NullPointerException
at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264) [rt.jar:1.8.0_282]

ERROR [net.sf.jasperreports.engine.util.JRStyledTextParser] (default task-19) Error while loading available fonts: java.lang.NullPointerException
at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264) [rt.jar:1.8.0_282]

Reading other threads on github, i found a suggestion to install the fontconfig (sudo yum install fontconfig dejavu-sans-fonts dejavu-serif-fonts ), however this hasn't worked for all.
Could you please suggest what can i do as workaround to get passed this issue.

Regards,
Alok

@titou10titou10
Copy link

@alokbaranwal
Copy link
Author

Hello @titou10titou10 ,
Thanks for your input.
In my case , as mentioned the RHEL version is 7.6 and the error i am getting while generating Jasper PDF letter is not ArrayIndexOutOfBound, but rather its as below.

Do you think creation of a file /etc/fonts/local.conf (with the content suggested in the link you gave) could be a possible resolution?
javax.ejb.EJBException: net.sf.jasperreports.engine.JRRuntimeException: Error initializing graphic environment.
...
Caused by: net.sf.jasperreports.engine.JRRuntimeException: Error initializing graphic environment.
...
Caused by: java.lang.NullPointerException
at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264) [rt.jar:1.8.0_282]

ERROR [net.sf.jasperreports.engine.util.JRStyledTextParser] (default task-19) Error while loading available fonts: java.lang.NullPointerException
at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264) [rt.jar:1.8.0_282]

@titou10titou10
Copy link

@alokbaranwal honestly I don't know. You problem seems similar in some way to the one we hit months ago, ie jasper + java8 + rhel v7.x + awt ... complaining with font problem... Probably you could give it a try.
I though the link I gave could give you a clue. If not then sorry for the noise

@karianna
Copy link
Member

karianna commented May 5, 2021

see #75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants