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 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?

          Jiri Macku added a comment - - edited

          danielbeck it popped up when trying to upgrade from 2.346.2 to 2.361.1
          I'm not sure how long this piece of xml was in the config.xml.
          I don't use any JRuby/Python based plugins.
          I don't know if it might be relevant but I have been using java 8 until recently.
          I've switched to Java 11 with the 2.361 as it is required now.

          Jiri Macku added a comment - - edited danielbeck it popped up when trying to upgrade from 2.346.2 to 2.361.1 I'm not sure how long this piece of xml was in the config.xml. I don't use any JRuby/Python based plugins. I don't know if it might be relevant but I have been using java 8 until recently. I've switched to Java 11 with the 2.361 as it is required now.

          Guido Schaumann added a comment - - edited

          I got the same issue, my code looks like this:

            <globalNodeProperties>
              <hudson.slaves.EnvironmentVariablesNodeProperty>
                <envVars serialization="custom">
                  <unserializable-parents/>
                  <tree-map>
                    <default>
                      <comparator class="java.lang.String$CaseInsensitiveComparator" reference="../../../../../../views/io.jenkins.plugins.view.calendar.CalendarView/jobNames/comparator"/>
                    </default>
                    <int>4</int>
                    <string>asd</string>
                    <string>123</string>
                  </tree-map>
                </envVars>
              </hudson.slaves.EnvironmentVariablesNodeProperty>
            </globalNodeProperties>
           

           We used a ruby-runtime plugin before at some point, but we deleted it.

          So I understood the int is wrong, what should there be instead?

          Guido Schaumann added a comment - - edited I got the same issue, my code looks like this: <globalNodeProperties>     <hudson.slaves.EnvironmentVariablesNodeProperty>       <envVars serialization= "custom" >         <unserializable-parents/>         <tree-map>           < default >             <comparator class= "java.lang. String $CaseInsensitiveComparator" reference= "../../../../../../views/io.jenkins.plugins.view.calendar.CalendarView/jobNames/comparator" />           </ default >           < int >4</ int >           <string>asd</string>           <string>123</string>         </tree-map>       </envVars>     </hudson.slaves.EnvironmentVariablesNodeProperty>   </globalNodeProperties>  We used a ruby-runtime plugin before at some point, but we deleted it. So I understood the int is wrong, what should there be instead?

          Jonah Kemuel added a comment - - edited

          I was not able to solve the int issue, from my test server, I deleted all the nodes and deleted ruby-runtime and pyenv-pipeline plugin which made it work. Wish me luck in making it work on our live jenkins without removing the nodes.

          Jonah Kemuel added a comment - - edited I was not able to solve the int issue, from my test server, I deleted all the nodes and deleted  ruby-runtime and pyenv-pipeline  plugin which made it work. Wish me luck in making it work on our live jenkins without removing the nodes.

          Daniel Beck added a comment -

          shampoonator  That looks like something that should be deserializable. I would expect your problem to be elsewhere, or it's a different error message.

          Daniel Beck added a comment - shampoonator   That looks like something that should be deserializable. I would expect your problem to be elsewhere, or it's a different error message.

          Jonah Kemuel added a comment -

          shampoonator i stumbled into a stable jenkins server when doing this for my live jenkins. I initially removed the int in the configuration, then there were some data that needed to be discarded then I returned the int and it is now working.

          Jonah Kemuel added a comment - shampoonator i stumbled into a stable jenkins server when doing this for my live jenkins. I initially removed the int in the configuration, then there were some data that needed to be discarded then I returned the int and it is now working.

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

              Created:
              Updated: