Adam Bien's Weblog

Jenkins: hudson.util.AWTProblem: java.lang.NullPointerException And Solution

The following Jenkins (1.548) exception is caused by the lack of the "devel" part of the JDK.


SEVERE: Failed to initialize Jenkins
hudson.util.AWTProblem: java.lang.NullPointerException
	at hudson.WebAppMain.contextInitialized(WebAppMain.java:182)
	at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782)
	at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)
	at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
[...]
Caused by: 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)
	at sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:753)
	at sun.font.SunFontManager$2.run(SunFontManager.java:430)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.font.SunFontManager.<init>(SunFontManager.java:375)
	at sun.awt.X11FontManager.<init>(X11FontManager.java:32)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
[...]

The problem can be mitigated by installing the full jdk. e.g.: yum -y install java-1.8.0-openjdk-devel or installing the current https://jdk8.java.net. However, the Jenkins 1.548 is using an older XStream library, which is not compatible with Java 8. If you get the following exception: http://jira.codehaus.org/browse/XSTR-746 you will have to move "back" to JDK 1.7.

See you at Java EE Workshops at MUC Airport or on demand and in a location very near you: airhacks.io!


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

Comments:

Thanks, I just had exactly the same problem (using Java 7). Your solution was perfect!

Posted by Dafydd James on November 16, 2014 at 11:59 PM CET #

I found an issue here: https://issues.jenkins-ci.org/browse/JENKINS-25261
【yum -y install fontconfig dejavu-sans-fonts】works

Posted by lee xy on December 03, 2015 at 07:20 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
Online Workshops
...the last 150 posts
...the last 10 comments
License