当前位置: 代码迷 >> Ruby/Rails >> 起动jenkins,报错Caused by: java.lang.InternalError: Can't connect to X11 window
  详细解决方案

起动jenkins,报错Caused by: java.lang.InternalError: Can't connect to X11 window

热度:641   发布时间:2016-04-29 02:08:30.0
启动jenkins,报错Caused by: java.lang.InternalError: Can't connect to X11 window

?????????????????????? 启动jenkins,报错解决办法,错误如下:

SEVERE: Failed to initialize Jenkins
hudson.util.AWTProblem: java.lang.InternalError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.
??? at hudson.WebAppMain.contextInitialized(WebAppMain.java:185)
??? at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
??? at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524)
??? at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
??? at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
??? at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
??? at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
??? at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1081)
??? at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1877)
??? at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
??? at java.util.concurrent.FutureTask.run(FutureTask.java:262)
??? at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
??? at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
??? at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.InternalError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.
??? at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
??? at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
??? at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:110)
??? at java.security.AccessController.doPrivileged(Native Method)
??? at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
??? at java.lang.Class.forName0(Native Method)
??? at java.lang.Class.forName(Class.java:191)
??? at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:102)
??? at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
??? at sun.awt.X11FontManager.isHeadless(X11FontManager.java:487)
??? at sun.awt.X11FontManager.getFileNameFromPlatformName(X11FontManager.java:168)
??? at sun.font.SunFontManager.initCompositeFonts(SunFontManager.java:3483)
??? at sun.font.SunFontManager.access$700(SunFontManager.java:65)
??? at sun.font.SunFontManager$2.run(SunFontManager.java:545)
??? 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:379)
??? 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:255)
??? at hudson.WebAppMain.contextInitialized(WebAppMain.java:184)
??? ... 13 more
原因:因为用到了图形处理,java程序会去寻找linux上的图形界面是否启动
解决:不让java寻找linux图形界面即可,在java 启动时加选项java -Djava.awt.headless=true?
实现:如果是tomcat,在/tomcat/bin/catalina.sh中修改为

JAVA_OPTS=-Djava.awt.headless=true

?

  相关解决方案