CentOS7.8启动jenkins报涉及font的错
- 持续集成
- 2022-07-20
- 13热度
- 0评论
因为等保测评要求,需将测试和生产的网络隔离,由于原有的 jenkins 中,测试和生产的部署 job 都在一个服务,现需拆分出来,重新搭一套生产的jenkins专供生产自动发布使用,所以申请了一台 CentOS7.8 进行部署。
安装好jdk11,下载好最新的 jenkins LTS版本 war包, Jenkins 2.319.1,通过 java -jar 方式进行启动,启动命令如下:
echo java -version
export JENKINS_HOME="/home/weblogic/ci/jks_space/jenkins"
export LANG="GBK"
java -Xms2048m -Xmx2048m -jar jenkins.war --httpPort=8081
启动时候,发生了报错,报错信息如下:
Running from: /home/weblogic/ci/jks_space/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
2021-12-14 01:12:14.026+0000 [id=1] INFO org.eclipse.jetty.util.log.Log#initialized: Logging initialized @444ms to org.eclipse.jetty.util.log.JavaUtilLog
2021-12-14 01:12:14.092+0000 [id=1] INFO winstone.Logger#logInternal: Beginning extraction from war file
2021-12-14 01:12:14.990+0000 [id=1] WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2021-12-14 01:12:15.037+0000 [id=1] INFO org.eclipse.jetty.server.Server#doStart: jetty-9.4.43.v20210629; built: 2021-06-30T11:07:22.254Z; git: 526006ecfa3af7f1a27ef3a288e2bef7ea9dd7e8; jvm 11.0.11+9-LTS-194
2021-12-14 01:12:15.261+0000 [id=1] INFO o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2021-12-14 01:12:15.289+0000 [id=1] INFO o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0
2021-12-14 01:12:15.290+0000 [id=1] INFO o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults
2021-12-14 01:12:15.291+0000 [id=1] INFO o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 660000ms
2021-12-14 01:12:15.669+0000 [id=1] INFO hudson.WebAppMain#contextInitialized: Jenkins home directory: /home/weblogic/ci/jks_space/jenkins found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
2021-12-14 01:12:15.731+0000 [id=1] SEVERE hudson.util.BootFailure#publish: Failed to initialize Jenkins
java.lang.NullPointerException
at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1262)
at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)
at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)
at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:719)
at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:377)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:322)
at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
Caused: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84)
Caused: java.lang.InternalError
at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:86)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
at java.desktop/java.awt.Font.getFont2D(Font.java:497)
at java.desktop/java.awt.Font.getFamily(Font.java:1410)
at java.desktop/java.awt.Font.getFamily_NoClientCode(Font.java:1384)
at java.desktop/java.awt.Font.getFamily(Font.java:1376)
at java.desktop/java.awt.Font.toString(Font.java:1869)
at hudson.util.ChartUtil.<clinit>(ChartUtil.java:269)
at hudson.WebAppMain.contextInitialized(WebAppMain.java:251)
Caused: hudson.util.AWTProblem
at hudson.WebAppMain.contextInitialized(WebAppMain.java:252)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:1067)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:572)
at org.eclipse.jetty.server.handler.ContextHandler.contextInitialized(ContextHandler.java:996)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:746)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:379)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1449)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1414)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:910)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
at org.eclipse.jetty.server.Server.start(Server.java:423)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
at org.eclipse.jetty.server.Server.doStart(Server.java:387)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at winstone.Launcher.<init>(Launcher.java:192)
at winstone.Launcher.main(Launcher.java:369)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at Main._main(Main.java:311)
at Main.main(Main.java:114)
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/home/weblogic/ci/jks_space/jenkins/war/WEB-INF/lib/groovy-all-2.4.12.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2021-12-14 01:12:15.929+0000 [id=1] INFO o.e.j.s.handler.ContextHandler#doStart: Started w.@f9f3928{Jenkins v2.319.1,/,file:///home/weblogic/ci/jks_space/jenkins/war/,AVAILABLE}{/home/weblogic/ci/jks_space/jenkins/war}
2021-12-14 01:12:15.943+0000 [id=1] INFO o.e.j.server.AbstractConnector#doStart: Started ServerConnector@726e5805{HTTP/1.1, (http/1.1)}{0.0.0.0:8081}
2021-12-14 01:12:15.944+0000 [id=1] INFO org.eclipse.jetty.server.Server#doStart: Started @2363ms
解决方法:
方法一:
1、报错中有涉及到 font配置的报错,需要给操作系统安装相关的包,涉及包如下:
dejavu-fonts-common-2.33-6.el7.noarch.rpm
dejavu-sans-fonts-2.33-6.el7.noarch.rpm
fontconfig-2.13.0-4.3.el7.x86_64.rpm
fontpackages-filesystem-1.44-8.el7.noarch.rpm
2、下载以上的包(版本号根据你的操作系统对应下载就行),执行 rpm 命令进行安装,安装成功后,再次启动 jenkins 就可以了。
方法二:
直接 yum install fontconfig