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

Jenkins is not loading: java.lang.ClassCastException: class java.lang.Integer cannot be cast to class hudson.slaves.NodeProperty during upgrade from LTS 2.346.x to 2.361.1

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • core
    • None
    • Docker Image: jenkins/jenkins:lts-jdk11

      I upgraded from 2.346.3 to 2.361.1 and now Jenkins is not loading with the following error:

      java.lang.ClassCastException: class java.lang.Integer cannot be cast to class hudson.slaves.NodeProperty (java.lang.Integer is in module java.base of loader 'bootstrap'; hudson.slaves.NodeProperty is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @485a3466)
      	at hudson.model.Node.getNodeProperty(Node.java:496)
      	at org.jenkinsci.plugins.matrixauth.AmbiguityMonitor$NodeContributor.record(AmbiguityMonitor.java:135)
      	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
      	at org.jenkinsci.plugins.matrixauth.AmbiguityMonitor.recordAgents(AmbiguityMonitor.java:269)
      Caused: java.lang.reflect.InvocationTargetException
      	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 hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:109)
      Caused: java.lang.Error
      	at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:115)
      	at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:185)
      	at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305)
      	at jenkins.model.Jenkins$5.runTask(Jenkins.java:1160)
      	at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:222)
      	at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:121)
      	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:70)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      Caused: org.jvnet.hudson.reactor.ReactorException
      	at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:291)
      	at jenkins.InitReactorRunner.run(InitReactorRunner.java:49)
      	at jenkins.model.Jenkins.executeReactor(Jenkins.java:1195)
      	at jenkins.model.Jenkins.<init>(Jenkins.java:985)
      	at hudson.model.Hudson.<init>(Hudson.java:86)
      	at hudson.model.Hudson.<init>(Hudson.java:82)
      	at hudson.WebAppMain$3.run(WebAppMain.java:247)
      Caused: hudson.util.HudsonFailedToLoad
      	at hudson.WebAppMain$3.run(WebAppMain.java:264) 
      
      

      Thanks for the help.

          [JENKINS-69558] Jenkins is not loading: java.lang.ClassCastException: class java.lang.Integer cannot be cast to class hudson.slaves.NodeProperty during upgrade from LTS 2.346.x to 2.361.1

          Jonah Kemuel created issue -

          Daniel Beck added a comment -

          I recommend you check the config.xml files for your agents for unexpected contents, something seems very wrong in there. matrix-auth is iterating over node properties and finds an Integer instead of a NodeProperty.

          If you don't know how to read them, it's probably easiest to delete them / move them elsewhere temporarily, then restore them one by one, or recreate agents from scratch.

          Daniel Beck added a comment - I recommend you check the config.xml files for your agents for unexpected contents, something seems very wrong in there. matrix-auth is iterating over node properties and finds an Integer instead of a NodeProperty . If you don't know how to read them, it's probably easiest to delete them / move them elsewhere temporarily, then restore them one by one, or recreate agents from scratch.

          Basil Crow added a comment -

          I recommend you check the config.xml files for your agents for unexpected contents, something seems very wrong in there.

          Specifically any <nodeProperties> or <globalNodeProperties> configuration in ${JENKINS_HOME}/config.xml and ${JENKINS_HOME}/nodes/*/config.xml. Whatever has gone wrong for you should be resolvable by removing the bad data from those sections. If you can share a (sanitized) version of those sections with us, that might help us work backwards to identify how you ended up in this situation to begin with.

          Basil Crow added a comment - I recommend you check the config.xml files for your agents for unexpected contents, something seems very wrong in there. Specifically any <nodeProperties> or <globalNodeProperties> configuration in ${JENKINS_HOME}/config.xml and ${JENKINS_HOME}/nodes/*/config.xml . Whatever has gone wrong for you should be resolvable by removing the bad data from those sections. If you can share a (sanitized) version of those sections with us, that might help us work backwards to identify how you ended up in this situation to begin with.
          Mark Waite made changes -
          Summary Original: Jenkins is not loading: java.lang.ClassCastException: class java.lang.Integer cannot be cast to class hudson.slaves.NodeProperty during upgrade from LTS 2.346.x to 2.641 New: Jenkins is not loading: java.lang.ClassCastException: class java.lang.Integer cannot be cast to class hudson.slaves.NodeProperty during upgrade from LTS 2.346.x to 2.361.1

          Jonah Kemuel added a comment -

          I see, i did not know there are config.xml for each nodes. I removed the nodeProperties and globalNodeProperties from ${JENKINS_HOME}/config.xml only. I'll try your advice. Thanks.

          Jonah Kemuel added a comment - I see, i did not know there are config.xml for each nodes. I removed the nodeProperties and globalNodeProperties from ${JENKINS_HOME}/config.xml only. I'll try your advice. Thanks.

          Jonah Kemuel added a comment -

          So removing the nodeProperties and globalNodeProperties did not do anything so I ended up removing all the nodes by deleting them from ${JENKINS_HOME}/nodes/ and now I'm getting this error:

          java.lang.NoClassDefFoundError: org/jruby/javasupport/proxy/InternalJavaProxy

          I tried googling this error but so far did not find anything pertinent to my issue.

          Jonah Kemuel added a comment - So removing the nodeProperties and globalNodeProperties did not do anything so I ended up removing all the nodes by deleting them from ${JENKINS_HOME}/nodes/ and now I'm getting this error: java.lang.NoClassDefFoundError: org/jruby/javasupport/proxy/InternalJavaProxy I tried googling this error but so far did not find anything pertinent to my issue.

          Daniel Beck added a comment - - edited

          https://www.jenkins.io/blog/2021/12/22/deprecated-ruby-runtime/

          In addition, the Jenkins ruby runtime does not support Java 11. … One month from now, January 22nd, 2022, the default Jenkins update center will stop distributing the Ruby runtime plugin, the plugins that use the Ruby runtime, the Python runtime plugin, and the plugin that uses the Python runtime.

          My guess is that you've dismissed notifications that some installed plugins are deprecated. Here's a list of Ruby/Python based plugins we publish a deprecation notice for.

          Daniel Beck added a comment - - edited https://www.jenkins.io/blog/2021/12/22/deprecated-ruby-runtime/ In addition, the Jenkins ruby runtime does not support Java 11. … One month from now, January 22nd, 2022, the default Jenkins update center will stop distributing the Ruby runtime plugin , the plugins that use the Ruby runtime, the Python runtime plugin , and the plugin that uses the Python runtime. My guess is that you've dismissed notifications that some installed plugins are deprecated. Here's a list of Ruby/Python based plugins we publish a deprecation notice for.

          Jonah Kemuel added a comment -

          okay, i'll look into it next week. thank you

          Jonah Kemuel added a comment - okay, i'll look into it next week. thank you

          Jiri Macku added a comment -

          Hi,
          I hit the same issue but was able to fix it while deleting the content of the globalNodeProperties in config.xml
          The original content was

            <globalNodeProperties>
              <hudson.slaves.EnvironmentVariablesNodeProperty/>
              <int>1</int>
              <string>CUSTOM_VAR</string>
              <string>CUSTOM_VALUE</string>
            </globalNodeProperties>
          

          and I changed it to

          <globalNodeProperties/>
          

          Jiri Macku added a comment - Hi, I hit the same issue but was able to fix it while deleting the content of the globalNodeProperties in config.xml The original content was <globalNodeProperties> <hudson.slaves.EnvironmentVariablesNodeProperty/> < int >1</ int > <string>CUSTOM_VAR</string> <string>CUSTOM_VALUE</string> </globalNodeProperties> and I changed it to <globalNodeProperties/>

          Daniel Beck added a comment -

          Interesting, that's a very wrong serialization of an object. It would be useful to know how this came to be.

          jmacku Did you also use JRuby/Python Runtime based plugins recently or when this problem occurred?

          Daniel Beck added a comment - Interesting, that's a very wrong serialization of an object. It would be useful to know how this came to be. jmacku Did you also use JRuby/Python Runtime based plugins recently or when this problem occurred?

            Unassigned Unassigned
            kemuelverzosa Jonah Kemuel
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: