Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-65276

new maven jobs ignore configured JDK and use default JDK on agent

      After the yum upgrade of our jenkins server from v 2.176.3 to v 2.277.1 maven jobs will not use the configured JDK, but instead use the default JDK on the slave node. This appears to only effect jobs that are created after the upgrade, as existing jobs continue to use the configured JDK.
      The master and slave nodes are running CentOS Linux release 7.9.2009.
      All relevant plugins were upgraded following the upgrade of jenkins core (current version info is attached), and 3 JDKs are defined for this Jenkins server.

      To investigate this I created a new maven job (maven command = "validate -X") and selected one of the 3 JDKs we have defined for this Jenkins server ('OpenJDK-11.0.7_10').
      If I reopen the job in the configuration editor, the jenkins log will report this error

      Mar 31, 2021 7:52:23 PM WARNING hudson.scm.SubversionSCM getModuleRoot
      No JDK named '["OpenJDK-11.0.7_10",""]' found

      and the JDK field in the UI will show "(System)", although if I directly inspect the config.xml I see this:

      [root@dapajenkin200 jenkins]# cat jobs/smf_new_2/config.xml | grep "<jdk>"
       <jdk>[&quot;OpenJDK-11.0.7_10&quot;,&quot;&quot;]</jdk>

      Note that there is a change in how jenkins saves the jdk in the job configuration. In our other Jenkins server which has not been upgraded yet, the same job specifies the jdk like this

      [root@dapajenkim001 ~]# cat /jenkins/jobs/smf-trunk/config.xml | grep "<jdk>"
       <jdk>jdk-8u101</jdk>

       The console output for a run of this job shows that it is not using the specified JDK from under the tools folder on the Jenkins slave node

      [root@dapajenkin201 ~]# ls /jenkins/tools/hudson.model.JDK/
      jdk-8u101 jdk-8u161 OpenJDK-11.0.7_10

       but rather uses the default jdk on the host: 

      Started by user John McCullough
      Running as SYSTEM
      Building remotely on dapajenkin201 in workspace /jenkins/workspace/smf_new_2
      No JDK named '["OpenJDK-11.0.7_10",""]' found
      Checking out a fresh workspace because there's no workspace at /jenkins/workspace/smf_new_2
      Cleaning local Directory .
      Checking out http://svn/reco/services/smf/trunk/smf-trunk at revision '2021-03-31T19:36:36.271 +0000' --quiet
      Using sole credentials Jenkins.SVN/****** (This account is intended to be used only by Jenkins for accessing svn. This limited scope of usage is important when auditing access of svn for troubleshooting.) in realm '*****'
      At revision 359776
      No JDK named '["OpenJDK-11.0.7_10",""]' found
      No JDK named '["OpenJDK-11.0.7_10",""]' found
      Parsing POMs
      using global settings config with name GlobalRecondoMavenSettings.xml
      Replacing all maven server entries not found in credentials list is true
      Downloaded artifact http://papaafrepo001:8081/artifactory/repo/epa/components/service/2021.3.0-SNAPSHOT/maven-metadata.xml
      Downloaded artifact http://papaafrepo001:8081/artifactory/repo/epa/components/2021.3.0-SNAPSHOT/maven-metadata.xml
      Discovered a new module epa.services:smf smf
      Modules changed, recalculating dependency graph
      Established TCP socket on 43153
      maven35-agent.jar already up to date
      maven35-interceptor.jar already up to date
      maven3-interceptor-commons.jar already up to date
      [smf_new_2] $ java -cp /jenkins/maven35-agent.jar:/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.5.3/apache-maven-3.5.3/boot/plexus-classworlds-2.5.2.jar:/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.5.3/apache-maven-3.5.3/conf/logging jenkins.maven3.agent.Maven35Main /jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.5.3/apache-maven-3.5.3 /jenkins/remoting.jar /jenkins/maven35-interceptor.jar /jenkins/maven3-interceptor-commons.jar 43153
      <===[JENKINS REMOTING CAPACITY]===>channel started
      using global settings config with name GlobalMavenSettings.xml
      Replacing all maven server entries not found in credentials list is true
      Executing Maven: -B -f /jenkins/workspace/smf_new_2/pom.xml -gs /tmp/global-settings7600775307120389479.xml validate -X
      [1mApache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T19:49:05Z)[m
      Maven home: /jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.5.3/apache-maven-3.5.3
      Java version: 1.8.0_282, vendor: Red Hat, Inc.
      Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre
      Default locale: en_US, platform encoding: UTF-8
      OS name: "linux", version: "3.10.0-1160.21.1.el7.x86_64", arch: "amd64", family: "unix"
      

       I did try deleting all 3 JDKs from the Global tool configuration and recreating them and the same behavior is still seen.

       

          [JENKINS-65276] new maven jobs ignore configured JDK and use default JDK on agent

          Mark Waite added a comment - - edited

          I can't duplicate the problem as reported. Steps I took while trying to duplicate it:

          1. Create a new maven job with Jenkins 2.277.1 (named JENKINS-65276-new-maven-job-ignores-jdk-setting) (I used git source control rather than subversion, but I assume the same behavior would be seen with subversion)
            1. Configured to run with jdk11 instead of the system default JDK
            2. Builds the target verify from the repository https://github.com/MarkEWaite/simple-java-maven-app.git
            3. Reports junit test results
            4. Makes the build unstable if specific text from JDK 11 invocation of apache-maven is not deteected
          2. Run the job, confirm that it passes
          3. Reconfigure the job to use JDK 8
          4. Run the job, confirm it is unstable
          5. Reconfigure the job to use JDK 11
          6. Run the job, confirm it succeeds

          Mark Waite added a comment - - edited I can't duplicate the problem as reported. Steps I took while trying to duplicate it: Create a new maven job with Jenkins 2.277.1 (named JENKINS-65276-new-maven-job-ignores-jdk-setting ) (I used git source control rather than subversion, but I assume the same behavior would be seen with subversion) Configured to run with jdk11 instead of the system default JDK Builds the target verify from the repository https://github.com/MarkEWaite/simple-java-maven-app.git Reports junit test results Makes the build unstable if specific text from JDK 11 invocation of apache-maven is not deteected Run the job, confirm that it passes Reconfigure the job to use JDK 8 Run the job, confirm it is unstable Reconfigure the job to use JDK 11 Run the job, confirm it succeeds

          Mark Waite added a comment - - edited

          I can duplicate the problem when I use your set of plugins. In my case, the message is:

          First time build. Skipping changelog.
          No JDK named ‘["jdk-11",""]’ found
          No JDK named ‘["jdk-11",""]’ found
          

          Your set of plugins includes the TFS plugin. It is known to have issues with the configuration form modernization ("tables to divs"). You'll need to remove the TFS plugin or Jenkins system configuration won't save. It may also affect saving Jenkins job definitions.

          Your set of plugins needs to be updated. The Jenkins 2.277.1 upgrade guide recommends that you update the plugins before upgrading to 2.277.1 then that you update the plugins immediately after the upgrade.

          The tables to divs migration guide recommends that you remove unused plugins and disable or remove plugins that are known to have issues with configuration form modernization. Once you've completed those steps, please check again to see if the issue persists.

          Mark Waite added a comment - - edited I can duplicate the problem when I use your set of plugins. In my case, the message is: First time build. Skipping changelog. No JDK named ‘["jdk-11",""]’ found No JDK named ‘["jdk-11",""]’ found Your set of plugins includes the TFS plugin. It is known to have issues with the configuration form modernization ("tables to divs"). You'll need to remove the TFS plugin or Jenkins system configuration won't save. It may also affect saving Jenkins job definitions. Your set of plugins needs to be updated. The Jenkins 2.277.1 upgrade guide recommends that you update the plugins before upgrading to 2.277.1 then that you update the plugins immediately after the upgrade. The tables to divs migration guide recommends that you remove unused plugins and disable or remove plugins that are known to have issues with configuration form modernization. Once you've completed those steps, please check again to see if the issue persists.

          John McCullough added a comment - - edited

          This problem was resolved after I uninstalled this plugin: Team Foundation Server Plug-in (tfs): 5.157.1

          Thank you!

          John McCullough added a comment - - edited This problem was resolved after I uninstalled this plugin: Team Foundation Server Plug-in (tfs): 5.157.1 Thank you!

          Mark Waite added a comment -

          Closed as duplicate of JENKINS-64241 (TFS issues with tables to divs)

          Mark Waite added a comment - Closed as duplicate of JENKINS-64241 (TFS issues with tables to divs)

            Unassigned Unassigned
            jmmccullough John McCullough
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: