Java 詹金斯无法启动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24829831/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 15:03:24  来源:igfitidea点击:

Jenkins Fails to Start

javajenkinsfreebsd

提问by max

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.

我们有一台运行 FreeBSD 9.1-p17 和 Jenkins 的服务器。我通过 PuTTY 与它互动。我们通过 FreeBSD 的端口集合从 Jenkins 1.458 升级到 1.570。由于这个启动问题,我们决定重新安装。

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.

首先我们卸载了 Jenkins,然后我们将主 Jenkins 文件夹(/usr/local/eweru-dev/jenkins)移动到一个备份位置,并重新安装(再次,从端口集合)。当我们重新安装时,我们保留了上次安装的用户“jenkins”。

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.

现在,当我们尝试启动 Jenkins 时,出现错误。下面的错误来自我们尝试通过导航到 /usr/local/share/jenkins 并键入java -jar jenkins.war. 当我们尝试将它作为服务(使用service jenkins onestart)运行时,我们得到了一个非常相似的消息。

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

异常看起来与此博客中的异常相似,但我尝试将 Jenkins 连接到 openjdk 7 和 8 无济于事。

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.

来自我们旧 Jenkins 安装的信息是否进入了这个,破坏了东西?或者也许 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.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.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.

任何帮助将不胜感激。我已经谷歌搜索了好几天了。

采纳答案by max

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

FreeBSD 服务器是无头服务器。所以它没有安装任何图形,包括字体。

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

出于某种原因,Jenkins 在加载时尝试访问字体。可以通过向-Djava.awt.headless=true容器 JVM添加选项来抑制此行为。这是对我有用的解决方案。

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

看起来有些操作系统会识别这种类型的错误,但 FreeBSD 不会。https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+got+java.awt.headless+problem

回答by Erxin

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

检查 jenkins 文件夹的权限。确保运行 jenkins 服务器的用户有权访问该文件夹。

回答by bviktor

For me -Djava.awt.headless=truedidn'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.

对我来说-Djava.awt.headless=true根本没有帮助。事实上,它已经在 Fedora 的默认配置中指定了,所以它很可能也在默认的 FreeBSD 配置中。对我来说,它错过了 fontconfig 包。

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

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

回答by Ramit Mitra

Am facing the same issue here, and adding -Djava.awt.headless=true doesn't help. I downloaded jenkins.war and tried running it using java -jar jenkins.waron windows 7 & 10 and it doesn't work. Am running java version,

我在这里面临同样的问题,添加 -Djava.awt.headless=true 没有帮助。我下载了 jenkins.war 并尝试java -jar jenkins.war在 Windows 7 和 10 上运行它,但它不起作用。我正在运行java版本,

java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

The solution that worked for me,
1. Uninstall all versions of java and updates from your system
2. Cleanup temporary files and registry (I used CCLeaner)
3. Download latest version from Oracle
4. Install and like this comment if this solution worked for you !

对我有用的解决方案
1. 从系统中卸载所有版本的 java 和更新
2. 清理临时文件和注册表(我使用 CCLeaner)
3. 从Oracle下载最新版本
4. 如果此解决方案适用,请安装并喜欢此评论你 !

Additionally, try removing the .jenkins directory, if possible

此外,如果可能,请尝试删除 .jenkins 目录