Issue Running Jenkins Jobs After Switching from Oracle Java to Azul Zulu Java

I recently updated my Jenkins setup and switched the Java runtime from Oracle Java to Azul Zulu Java. Since this update, Jenkins jobs that previously ran successfully are now failing. Below are the details:

Previous Java Version (Working): Oracle JDK 17 Current Java Version (Failing): Azul Zulu OpenJDK 17.0.13 (Zulu17.54+21-CA)
Pipeline failed with this error

[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2024-12-12 05:17:42,376 main DEBUG Apache Log4j Core 2.19.0 initializing configuration XmlConfiguration[location=C:\Users\CEPL\UI-Automation\workspace\PipelineDemo1\target\classes\log4j2.xml]
2024-12-12 05:17:42,377 main DEBUG PluginManager 'Core' found 130 plugins
2024-12-12 05:17:42,377 main DEBUG PluginManager 'Level' found 0 plugins
2024-12-12 05:17:42,381 main DEBUG PluginManager 'Lookup' found 16 plugins
2024-12-12 05:17:42,382 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
2024-12-12 05:17:42,393 main DEBUG PluginManager 'TypeConverter' found 26 plugins
2024-12-12 05:17:42,407 main DEBUG PatternLayout$Builder(pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n", PatternSelector=null, Configuration(C:\Users\CEPL\UI-Automation\workspace\PipelineDemo1\target\classes\log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", disableAnsi="null", noConsoleNoAnsi="null", header="null", footer="null")
2024-12-12 05:17:42,408 main DEBUG PluginManager 'Converter' found 45 plugins
2024-12-12 05:17:42,408 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.ConsoleAppender].
2024-12-12 05:17:42,416 main DEBUG ConsoleAppender$Builder(target="SYSTEM_OUT", follow="null", direct="null", bufferedIo="null", bufferSize="null", immediateFlush="null", ignoreExceptions="null", PatternLayout(%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n), name="LogToConsole", Configuration(C:\Users\CEPL\UI-Automation\workspace\PipelineDemo1\target\classes\log4j2.xml), Filter=null, ={})
2024-12-12 05:17:42,419 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false.false
2024-12-12 05:17:42,419 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
2024-12-12 05:17:42,420 main DEBUG PatternLayout$Builder(pattern="%d %p %c{1.} [%t] %m%n", PatternSelector=null, Configuration(C:\Users\CEPL\UI-Automation\workspace\PipelineDemo1\target\classes\log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", disableAnsi="null", noConsoleNoAnsi="null", header="null", footer="null")
2024-12-12 05:17:42,436 main DEBUG Building Plugin[name=TimeBasedTriggeringPolicy, class=org.apache.logging.log4j.core.appender.rolling.TimeBasedTriggeringPolicy].
2024-12-12 05:17:42,439 main DEBUG TimeBasedTriggeringPolicy$Builder(interval="null", modulate="null", maxRandomDelay="null")
2024-12-12 05:17:42,440 main DEBUG Building Plugin[name=SizeBasedTriggeringPolicy, class=org.apache.logging.log4j.core.appender.rolling.SizeBasedTriggeringPolicy].
2024-12-12 05:17:42,444 main DEBUG createPolicy(size="10 MB")
2024-12-12 05:17:42,447 main DEBUG Building Plugin[name=Policies, class=org.apache.logging.log4j.core.appender.rolling.CompositeTriggeringPolicy].
2024-12-12 05:17:42,448 main DEBUG createPolicy(={TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false), SizeBasedTriggeringPolicy(size=10485760)})
2024-12-12 05:17:42,448 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.RollingFileAppender].
2024-12-12 05:17:42,450 main DEBUG RollingFileAppender$Builder(fileName="logs/ExecutionLogs.log", filePattern="logs/${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log", append="null", locking="null", Policies(CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false), SizeBasedTriggeringPolicy(size=10485760)])), Strategy=null, advertise="null", advertiseUri="null", createOnDemand="null", filePermissions="null", fileOwner="null", fileGroup="null", bufferedIo="null", bufferSize="null", immediateFlush="null", ignoreExceptions="null", PatternLayout(%d %p %c{1.} [%t] %m%n), name="LogToRollingFile", Configuration(C:\Users\CEPL\UI-Automation\workspace\PipelineDemo1\target\classes\log4j2.xml), Filter=null, ={})
2024-12-12 05:17:42,459 main DEBUG Returning file creation time for C:\Users\CEPL\UI-Automation\workspace\PipelineDemo1\logs\ExecutionLogs.log
2024-12-12 05:17:42,459 main DEBUG Starting RollingFileManager logs/ExecutionLogs.log
2024-12-12 05:17:42,461 main DEBUG PluginManager 'FileConverter' found 2 plugins
2024-12-12 05:17:42,463 main DEBUG Setting prev file time to 2024-12-12T05:11:10.872-0500
2024-12-12 05:17:42,464 main DEBUG Initializing triggering policy CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false), SizeBasedTriggeringPolicy(size=10485760)])
2024-12-12 05:17:42,464 main DEBUG Initializing triggering policy TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false)
2024-12-12 05:17:42,464 main DEBUG Initializing triggering policy SizeBasedTriggeringPolicy(size=10485760)
2024-12-12 05:17:42,465 main DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].
2024-12-12 05:17:42,465 main DEBUG createAppenders(={LogToConsole, LogToRollingFile})
2024-12-12 05:17:42,466 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
2024-12-12 05:17:42,466 main DEBUG createAppenderRef(ref="LogToRollingFile", level="null", Filter=null)
2024-12-12 05:17:42,466 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig].
2024-12-12 05:17:42,469 main DEBUG LoggerConfig$Builder(additivity="null", level="DEBUG", levelAndRefs="null", name="com.cloudlex.testcases", includeLocation="null", ={LogToRollingFile}, ={}, Configuration(C:\Users\CEPL\UI-Automation\workspace\PipelineDemo1\target\classes\log4j2.xml), Filter=null)
2024-12-12 05:17:42,470 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
2024-12-12 05:17:42,471 main DEBUG createAppenderRef(ref="LogToRollingFile", level="null", Filter=null)
2024-12-12 05:17:42,471 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig].
2024-12-12 05:17:42,471 main DEBUG LoggerConfig$Builder(additivity="null", level="DEBUG", levelAndRefs="null", name="com.cloudlex.pages", includeLocation="null", ={LogToRollingFile}, ={}, Configuration(C:\Users\CEPL\UI-Automation\workspace\PipelineDemo1\target\classes\log4j2.xml), Filter=null)
2024-12-12 05:17:42,472 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
2024-12-12 05:17:42,472 main DEBUG createAppenderRef(ref="LogToRollingFile", level="null", Filter=null)
2024-12-12 05:17:42,473 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig].
2024-12-12 05:17:42,473 main DEBUG LoggerConfig$Builder(additivity="null", level="DEBUG", levelAndRefs="null", name="com.cloudlex.TestComponents", includeLocation="null", ={LogToRollingFile}, ={}, Configuration(C:\Users\CEPL\UI-Automation\workspace\PipelineDemo1\target\classes\log4j2.xml), Filter=null)
2024-12-12 05:17:42,474 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
2024-12-12 05:17:42,474 main DEBUG createAppenderRef(ref="LogToRollingFile", level="null", Filter=null)
2024-12-12 05:17:42,475 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig].
2024-12-12 05:17:42,475 main DEBUG LoggerConfig$Builder(additivity="null", level="DEBUG", levelAndRefs="null", name="com.cloudlex.utility", includeLocation="null", ={LogToRollingFile}, ={}, Configuration(C:\Users\CEPL\UI-Automation\workspace\PipelineDemo1\target\classes\log4j2.xml), Filter=null)
2024-12-12 05:17:42,475 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
2024-12-12 05:17:42,476 main DEBUG createAppenderRef(ref="LogToConsole", level="null", Filter=null)
2024-12-12 05:17:42,476 main DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
2024-12-12 05:17:42,477 main DEBUG LoggerConfig$RootLogger$Builder(additivity="null", level="ERROR", levelAndRefs="null", includeLocation="null", ={LogToConsole}, ={}, Configuration(C:\Users\CEPL\UI-Automation\workspace\PipelineDemo1\target\classes\log4j2.xml), Filter=null)
2024-12-12 05:17:42,477 main DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].
2024-12-12 05:17:42,478 main DEBUG createLoggers(={com.cloudlex.testcases, com.cloudlex.pages, com.cloudlex.TestComponents, com.cloudlex.utility, root})
2024-12-12 05:17:42,479 main DEBUG Configuration XmlConfiguration[location=C:\Users\CEPL\UI-Automation\workspace\PipelineDemo1\target\classes\log4j2.xml] initialized
2024-12-12 05:17:42,479 main DEBUG Starting configuration XmlConfiguration[location=C:\Users\CEPL\UI-Automation\workspace\PipelineDemo1\target\classes\log4j2.xml]
2024-12-12 05:17:42,479 main DEBUG Started configuration XmlConfiguration[location=C:\Users\CEPL\UI-Automation\workspace\PipelineDemo1\target\classes\log4j2.xml] OK.
2024-12-12 05:17:42,480 main DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false.false-1
2024-12-12 05:17:42,480 main DEBUG OutputStream closed
2024-12-12 05:17:42,480 main DEBUG Shut down OutputStreamManager SYSTEM_OUT.false.false-1, all resources released: true
2024-12-12 05:17:42,480 main DEBUG Appender DefaultConsole-1 stopped with status true
2024-12-12 05:17:42,480 main DEBUG Stopped org.apache.logging.log4j.core.config.DefaultConfiguration@5fa07e12 OK
2024-12-12 05:17:42,551 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44
2024-12-12 05:17:42,554 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=StatusLogger
2024-12-12 05:17:42,556 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=ContextSelector
2024-12-12 05:17:42,558 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=Loggers,name=
2024-12-12 05:17:42,559 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=Loggers,name=com.cloudlex.testcases
2024-12-12 05:17:42,559 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=Loggers,name=com.cloudlex.pages
2024-12-12 05:17:42,560 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=Loggers,name=com.cloudlex.TestComponents
2024-12-12 05:17:42,560 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=Loggers,name=com.cloudlex.utility
2024-12-12 05:17:42,561 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=Appenders,name=LogToConsole
2024-12-12 05:17:42,561 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=Appenders,name=LogToRollingFile
2024-12-12 05:17:42,563 main DEBUG org.apache.logging.log4j.core.util.SystemClock supports precise timestamps.
2024-12-12 05:17:42,563 main DEBUG Reconfiguration complete for context[name=c387f44] at URI C:\Users\CEPL\UI-Automation\workspace\PipelineDemo1\target\classes\log4j2.xml (org.apache.logging.log4j.core.LoggerContext@2796aeae) with optional ClassLoader: null
2024-12-12 05:17:42,564 main DEBUG Shutdown hook enabled. Registering a new one.
2024-12-12 05:17:42,565 main DEBUG LoggerContext[name=c387f44, org.apache.logging.log4j.core.LoggerContext@2796aeae] started OK.
...
... TestNG 7.6.1 by Cédric Beust (cedric@beust.com)
...

[ERROR] Tests run: 4, Failures: 2, Errors: 0, Skipped: 2, Time elapsed: 3.671 s <<< FAILURE! -- in TestSuite
[ERROR] com.cloudlex.testcases.ContactManager.ContactManagerAddTest.browserSetUp[prod](0) -- Time elapsed: 3.435 s <<< FAILURE!
java.awt.HeadlessException: 

The application does not have desktop access,
but this program performed an operation which requires it.
    at java.desktop/sun.awt.HeadlessToolkit.getScreenSize(HeadlessToolkit.java:186)
    at com.cloudlex.utility.BrowserFactory.launchBrowser(BrowserFactory.java:75)
    at com.cloudlex.TestComponents.BaseClass.browserSetUp(BaseClass.java:53)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:569)
    at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
    at org.testng.internal.invokers.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:69)
    at org.testng.internal.invokers.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:361)
    at org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:296)
    at org.testng.TestRunner.invokeTestConfigurations(TestRunner.java:643)
    at org.testng.TestRunner.beforeRun(TestRunner.java:632)
    at org.testng.TestRunner.run(TestRunner.java:594)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:433)
    at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:471)
    at org.testng.internal.thread.ThreadUtil.lambda$execute$0(ThreadUtil.java:58)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:840)

Even after configuring Jenkins with -Djava.awt.headless=false in jenkins.xml, the issue persists.

1.Is there any known incompatibility between Jenkins and Azul Zulu Java 17?
2.Are there additional configurations needed for Jenkins to work properly with Azul Zulu?
3.Why might Oracle Java allow system access that Azul Zulu does not?

Environment Details:
Jenkins Version: Version 2.479.2
OS: Windows 10/11
Java Version: Azul Zulu OpenJDK 17.0.13 (Zulu17.54+21-CA, build 17.0.13+11-LTS)

Here is my pipeline script for this test

Note : The same Script is worked fine before switching to Azul Java

pipeline {
    agent any

    parameters {
        string(name: 'TESTNG_FILE', defaultValue: 'testng1.xml', description: 'Path to the TestNG XML file')
    }

    tools {
        // Install the Maven version configured as "Maven" and add it to the path.
        maven "Maven"
    }

    stages {
        stage('Checkout Code') {
            steps {
                // Get some code from a GitHub repository
                git branch: //used my private repo
            }
        }
        stage('Build and Run Tests') {
            steps {
                script {
                    def testngFilePath = "${params.TESTNG_FILE}"
                    echo "Running tests with TestNG file: ${testngFilePath}"
                }
                // Use bat command for Windows agents
                bat """
                    mvn clean test -DsuiteXmlFile=${params.TESTNG_FILE}
                """
            }
        }
    }

    post {
        always {
        // Actions that run only when the pipeline succeeds
            junit '**/target/surefire-reports/TEST-*.xml'
            archiveArtifacts 'target/**/testng-results.xml'
        }
    }
}

I don’t think that the incompatibility is between Jenkins and the Azul VM. It seems that you have tests (com.cloudlex.TestComponents) that expect to run a web browser and the HeadlessToolkit from the java.desktop module expects to read the screen size from the Windows desktop.

If you have tests that require access to a Windows desktop, then I think that you’ll need to run the agent from a Windows session that has access to the Windows desktop.

Thank you for the response @MarkEWaite i have given the access even though issue not resolved but for now i have commented that line now its working fine

Thank you!