Jekins run canot connect X in my test server (Linux Red Hat)

hi,

suddently i am getting this error when i’ll try to execute Jenkins job

org.codehaus.groovy.runtime.InvokerInvocationException: java.awt.AWTError: Can’t connect to X11 window server using ‘:1’ as the value of the DISPLAY variable. %

I have used in Jenkins
#!/bin/bash
export DISPLAY=:1
cd /home/xxxx
/var/Katalon_Studio_Linux_64-5.8.6/katalon -noSplash -runMode=console -projectPath="$WORKSPACE/katalon-project.prj" -retry=0 -testSuitePath=“Test Suites/NightlyTestSuite” -executionProfile=“default” -browserType=“Chrome (headless)” -reportFolder="$WORKSPACE/Reports" -apiKey=cc8af8de-a3d9-4dee-8e42-ac8753ae4b6d
set +e

and X is running
[root@testframe-ng ~]# pidof X && echo “yup X server is running”
1435
yup X server is running

both plugins run in my server
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 2894/Xvnc
tcp 0 0 0.0.0.0:6099 0.0.0.0:* LISTEN 1359/Xvfb

how this issue occur? without any change or after an update on jenkins machine? have you tried to reboot-it?

hi,

some kernel update was there

check this also, perhaps the display port has changed:

hi,

port is 6001

look for the DISPLAY
the 6001 is the port the daemon is listening, that one looks ok

hello

00:00:00 Xvfb :99 -ac -screen 0 1280x1024x24

so ,try to change export DISPLAY to 99 in your bash script

i mean, 0, sorry. screen value i think should match with DISPLAY variable.or try both :slight_smile:

hi,
tried with 0 will get same error, now trying with 99

hi,

this will start to work
export DISPLAY=:99

1 Like

glad to hear you fix it!

1 Like

@Timo_Kuisma2 now we know. the ‘:number’ should match with the DISPLAY variable. the ‘screen’ i think is related to virtual desktop.
make a note of it, some other users may have same issue
if during a day we learn nothing, that day is lost :slight_smile:

hi,

sure, when i have time to do it

hi,

is this enough

1 Like

yeah, should be ok

Check your display number

ps -ef|grep Xvfb

00:00:00 Xvfb :99 -ac -screen 0 1280x1024x24

as here it is 99

in your Jenkins script use this as display number
like
export DISPLAY=:99

reference doc: https://linux.die.net/man/1/xvfb
you can control how the xfvb is started.
how to actually do it, depends if you are using jenkins xfvb plugin, or do you start/pass the options via third-party scripts.
however make note that the $DISPLAY value should match in both, the daemon launching script and in your katalon execution script.