Jenkins Fails to Start

14,043

Solution 1

The FreeBSD server is a headless server. So it doesn't have any graphics installed, including fonts.

For some reason, Jenkins tries to access fonts when it loads. This behavior can be suppressed by adding the option -Djava.awt.headless=true to the container JVM. This is the solution that worked for me.

It looks like some operating systems recognize this type of error, but FreeBSD does not. https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+got+java.awt.headless+problem

Solution 2

Check the permission of the jenkins folder. make sure the user run the jenkins server have the permission to access the folder.

Solution 3

For me -Djava.awt.headless=true didn't help at all. In fact, it's already specified in the Fedora default config, so chances are it's also in the default FreeBSD config. For me it missed the fontconfig package.

Details: http://vault-tec.info/post/98877792626/jenkins-service-unavailable

Share:
14,043
Admin
Author by

Admin

Updated on June 14, 2022

Comments

  • Admin
    Admin about 2 years

    We have a server running FreeBSD 9.1-p17 and Jenkins. I interact with it via PuTTY. We upgraded from Jenkins 1.458 to 1.570, via FreeBSD's ports collection. Due to this problem with starting, we decided to reinstall.

    First we uninstalled Jenkins, then we moved the main Jenkins folder (/usr/local/eweru-dev/jenkins) to a backup location, and reinstalled (again, from the ports collection). When we reinstalled, we kept the user 'jenkins' from the last install.

    Now, when we try to start Jenkins, we get an error. The error below is from when we try to start it by navigating to /usr/local/share/jenkins and typing java -jar jenkins.war. When we try to run it as a service (with service jenkins onestart), we get a very similar message.

    The exception looks similar to the one from this blog, but I have tried connecting Jenkins to openjdk 7 and 8 to no avail.

    Is information from our old Jenkins install finding its way into this one, breaking stuff? Or maybe there's some compatibility issue with FreeBSD 9.1.

    Running from: /usr/local/share/jenkins/jenkins.war
    webroot: $user.home/.jenkins
    Jul 18, 2014 10:53:51 AM winstone.Logger logInternal
    INFO: Beginning extraction from war file
    Jul 18, 2014 10:53:51 AM org.eclipse.jetty.util.log.JavaUtilLog info
    INFO: jetty-8.y.z-SNAPSHOT
    Jul 18, 2014 10:53:55 AM org.eclipse.jetty.util.log.JavaUtilLog info
    INFO: NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet
    Jenkins home directory: /homes/maxerdwien/.jenkins found at: $user.home/.jenkins
    Jul 18, 2014 10:53:55 AM hudson.util.BootFailure publish
    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)
            at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
            at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
            at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
            at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
            at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
            at org.eclipse.jetty.server.Server.doStart(Server.java:282)
            at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
            at winstone.Launcher.<init>(Launcher.java:154)
            at winstone.Launcher.main(Launcher.java:354)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at Main._main(Main.java:293)
            at Main.main(Main.java:98)
    Caused by: java.lang.NullPointerException
            at sun.awt.X11FontManager.getDefaultPlatformFont(X11FontManager.java:779)
            at sun.font.SunFontManager$2.run(SunFontManager.java:433)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.font.SunFontManager.<init>(SunFontManager.java:376)
            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:526)
            at java.lang.Class.newInstance(Class.java:374)
            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:490)
            at java.awt.Font.getFamily(Font.java:1219)
            at java.awt.Font.getFamily_NoClientCode(Font.java:1193)
            at java.awt.Font.getFamily(Font.java:1185)
            at java.awt.Font.toString(Font.java:1682)
            at hudson.util.ChartUtil.<clinit>(ChartUtil.java:229)
            at hudson.WebAppMain.contextInitialized(WebAppMain.java:181)
            ... 19 more
    
    Jul 18, 2014 10:53:56 AM org.eclipse.jetty.util.log.JavaUtilLog warn
    WARNING: Failed startup of context w.{,file:/home/maxerdwien/.jenkins/war/},/homes/maxerdwien/.jenkins/war
    java.lang.NullPointerException
            at jenkins.util.groovy.GroovyHookScript.run(GroovyHookScript.java:63)
            at hudson.util.BootFailure.publish(BootFailure.java:43)
            at hudson.WebAppMain.contextInitialized(WebAppMain.java:244)
            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)
            at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
            at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
            at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
            at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
            at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
            at org.eclipse.jetty.server.Server.doStart(Server.java:282)
            at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
            at winstone.Launcher.<init>(Launcher.java:154)
            at winstone.Launcher.main(Launcher.java:354)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at Main._main(Main.java:293)
            at Main.main(Main.java:98)
    
    Jul 18, 2014 10:53:56 AM org.eclipse.jetty.util.log.JavaUtilLog info
    INFO: Started [email protected]:8080
    Jul 18, 2014 10:53:56 AM winstone.Logger logInternal
    INFO: Winstone Servlet Engine v2.0 running: controlPort=disabled
    

    Any help would be very appreciated. I've been googling for days.

  • cgon
    cgon almost 10 years
    Font names are being fetched by using x service. "The FreeBSD server is a headless server." this is a wrong argument. You can configure to use it if you have any video card available to your os:freebsd.org/doc/en_US.ISO8859-1/books/handbook/x-config.h‌​tml