javajenkinsjenkins-pluginsjava-17tomcat9

Jenkins Boot Failing after upgrade to JDK 17


We are running Jenkins 2.426.3 on Windows servers and Apache Tomcat 9.0.89 currently with Java JDK 11. We tried switching to JDK 17, but ran into this error when starting Tomcat:

16-Aug-2024 16:46:00.664 INFO [Inspecting plugin F:\Jenkins\plugins\blueocean-git-pipeline.hpi] jenkins.InitReactorRunner$1.onAttained Loaded all jobs
16-Aug-2024 16:46:00.703 INFO [Inspecting plugin F:\Jenkins\plugins\blueocean-github-pipeline.hpi] jenkins.InitReactorRunner$1.onAttained Configuration for all jobs updated
16-Aug-2024 16:46:00.722 INFO [Download metadata thread] hudson.util.Retrier.start Attempt #1 to do the action check updates server
16-Aug-2024 16:46:04.306 INFO [Inspecting plugin F:\Jenkins\plugins\blueocean-github-pipeline.hpi] jenkins.InitReactorRunner$1.onAttained Completed initialization
16-Aug-2024 16:46:04.322 SEVERE [Jenkins initialization thread] hudson.util.BootFailure.publish Failed to initialize Jenkins
    hudson.util.HudsonFailedToLoad: java.io.IOException: java.lang.RuntimeException: Failed to serialize jenkins.model.Jenkins#views for class hudson.model.Hudson
        at hudson.WebAppMain$3.run(WebAppMain.java:264)
    Caused by: java.io.IOException: java.lang.RuntimeException: Failed to serialize jenkins.model.Jenkins#views for class hudson.model.Hudson
        at hudson.XmlFile.write(XmlFile.java:223)
        at jenkins.model.Jenkins.save(Jenkins.java:3624)
        at jenkins.model.Jenkins.<init>(Jenkins.java:1013)
        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 by: java.lang.RuntimeException: Failed to serialize jenkins.model.Jenkins#views for class hudson.model.Hudson
        at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
        at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:241)
        at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:174)
        at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:226)
        at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:163)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:59)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:44)
        at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:83)
        at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
        at com.thoughtworks.xstream.XStream.marshal(XStream.java:1303)
        at com.thoughtworks.xstream.XStream.marshal(XStream.java:1292)
        at com.thoughtworks.xstream.XStream.toXML(XStream.java:1265)
        at hudson.XmlFile.write(XmlFile.java:216)
        ... 5 more
    Caused by: java.lang.RuntimeException: Failed to serialize hudson.model.ListView#jobNames for class hudson.model.ListView
        at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
        at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:241)
        at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:174)
        at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:226)
        at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:163)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:59)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:44)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
        at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeBareItem(AbstractCollectionConverter.java:94)
        at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:66)
        at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeCompleteItem(AbstractCollectionConverter.java:81)
        at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:75)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:59)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
        at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:283)
        at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
        ... 18 more
    Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private static final long java.lang.String$CaseInsensitiveComparator.serialVersionUID accessible: module java.base does not "opens java.lang" to unnamed module @24f055ef
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
        at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
        at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
        at com.thoughtworks.xstream.converters.reflection.FieldDictionary.buildDictionaryEntryForClass(FieldDictionary.java:176)
        at com.thoughtworks.xstream.converters.reflection.FieldDictionary.buildMap(FieldDictionary.java:142)
        at com.thoughtworks.xstream.converters.reflection.FieldDictionary.fieldsFor(FieldDictionary.java:80)
        at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:167)
        at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:206)
        at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:163)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:59)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:44)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
        at com.thoughtworks.xstream.converters.collections.TreeMapConverter.marshalComparator(TreeMapConverter.java:67)
        at com.thoughtworks.xstream.converters.collections.TreeSetConverter.marshal(TreeSetConverter.java:52)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:59)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
        at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:283)
        at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
        ... 35 more
16-Aug-2024 16:46:04.330 INFO [Jenkins initialization thread] hudson.lifecycle.Lifecycle.onStatusUpdate Stopping Jenkins
16-Aug-2024 16:46:04.374 INFO [Jenkins initialization thread] jenkins.model.Jenkins$16.onAttained Started termination
16-Aug-2024 16:46:04.385 INFO [Jenkins initialization thread] hudson.plugins.build_timeout.global.Lifecycle.shutdown Shutdown complete - Global TimeOut ScheduledExecutorService had 0 tasks pending
16-Aug-2024 16:46:11.407 WARNING [Jenkins initialization thread] org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$9.onFailure null
    org.jenkinsci.remoting.util.ExecutorServiceUtils$FatalRejectedExecutionException: Cannot execute the command java.util.concurrent.FutureTask@49f2a3b3[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@7e92a04[Wrapped task = org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1@18a3bf79]]. The executor service is shutting down
        at hudson.remoting.SingleLaneExecutorService.execute(SingleLaneExecutorService.java:116)
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:123)
        at jenkins.util.InterceptingExecutorService.submit(InterceptingExecutorService.java:46)
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$5.onSuccess(CpsFlowExecution.java:925)
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$5.onSuccess(CpsFlowExecution.java:921)
        at org.jenkinsci.plugins.workflow.support.concurrent.Futures$1.run(Futures.java:147)
        at org.jenkinsci.plugins.workflow.support.concurrent.DirectExecutor.execute(DirectExecutor.java:33)
        at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1286)
        at com.google.common.util.concurrent.AbstractFuture.addListener(AbstractFuture.java:760)
        at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.addListener(AbstractFuture.java:134)
        at org.jenkinsci.plugins.workflow.support.concurrent.Futures.addCallback(Futures.java:157)
        at org.jenkinsci.plugins.workflow.support.concurrent.Futures.addCallback(Futures.java:97)
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.runInCpsVmThread(CpsFlowExecution.java:921)
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.suspendAll(CpsFlowExecution.java:1678)
        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:568)
        at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:109)
        at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:185)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:221)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:120)
        at org.jvnet.hudson.reactor.Reactor$Node.runIfPossible(Reactor.java:142)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:131)
        at org.jvnet.hudson.reactor.Reactor$Node.runIfPossible(Reactor.java:142)
        at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:284)
        at jenkins.model.Jenkins._cleanUpRunTerminators(Jenkins.java:3735)
        at jenkins.model.Jenkins.cleanUp(Jenkins.java:3658)
        at hudson.WebAppMain$3.run(WebAppMain.java:268)
16-Aug-2024 16:46:11.844 INFO [Jenkins initialization thread] jenkins.model.Jenkins$16.onAttained Completed termination
16-Aug-2024 16:46:11.844 INFO [Jenkins initialization thread] jenkins.model.Jenkins._cleanUpDisconnectComputers Starting node disconnection
16-Aug-2024 16:46:12.170 INFO [Jenkins initialization thread] jenkins.model.Jenkins._cleanUpShutdownPluginManager Stopping plugin manager
16-Aug-2024 16:46:12.212 INFO [Jenkins initialization thread] jenkins.model.Jenkins._cleanUpPersistQueue Persisting build queue
16-Aug-2024 16:46:12.227 WARNING [Jenkins initialization thread] hudson.model.listeners.SaveableListener.fireOnChange null
    java.lang.NullPointerException: Cannot invoke "hudson.plugins.jobConfigHistory.JobConfigHistory.isSaveable(hudson.model.Saveable, hudson.XmlFile)" because "plugin" is null
        at hudson.plugins.jobConfigHistory.JobConfigHistorySaveableListener.onChange(JobConfigHistorySaveableListener.java:55)
        at hudson.model.listeners.SaveableListener.fireOnChange(SaveableListener.java:82)
        at hudson.model.Queue.save(Queue.java:479)
        at jenkins.model.Jenkins._cleanUpPersistQueue(Jenkins.java:3921)
        at jenkins.model.Jenkins.cleanUp(Jenkins.java:3676)
        at hudson.WebAppMain$3.run(WebAppMain.java:268)
16-Aug-2024 16:46:12.227 INFO [Jenkins initialization thread] jenkins.model.Jenkins._cleanUpAwaitDisconnects Waiting for node disconnection completion
16-Aug-2024 16:46:12.227 SEVERE [Jenkins initialization thread] jenkins.model.Jenkins._cleanUpPluginServletFilters Failed to stop filters
    java.lang.NoClassDefFoundError: net/bull/javamelody/MonitoringInitialContextFactory
        at net.bull.javamelody.FilterContext.destroy(FilterContext.java:472)
        at net.bull.javamelody.MonitoringFilter.destroy(MonitoringFilter.java:176)
        at net.bull.javamelody.PluginMonitoringFilter.destroy(PluginMonitoringFilter.java:74)
        at hudson.util.PluginServletFilter.cleanUp(PluginServletFilter.java:191)
        at jenkins.model.Jenkins._cleanUpPluginServletFilters(Jenkins.java:3985)
        at jenkins.model.Jenkins.cleanUp(Jenkins.java:3682)
        at hudson.WebAppMain$3.run(WebAppMain.java:268)
    Caused by: java.lang.ClassNotFoundException: net.bull.javamelody.MonitoringInitialContextFactory
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
        at jenkins.util.URLClassLoader2.findClass(URLClassLoader2.java:35)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
        ... 7 more
16-Aug-2024 16:46:12.242 INFO [Jenkins initialization thread] hudson.lifecycle.Lifecycle.onStatusUpdate Jenkins stopped
16-Aug-2024 16:46:12.430 SEVERE [SyncQueueListener] hudson.init.impl.InstallUncaughtExceptionHandler$DefaultUncaughtExceptionHandler.uncaughtException A thread (SyncQueueListener/73) died unexpectedly due to an uncaught exception. This may leave your server corrupted and usually indicates a software bug.
    java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong.
        at jenkins.model.Jenkins.get(Jenkins.java:819)
        at hudson.model.Queue.getInstance(Queue.java:3077)
        at org.jenkinsci.plugins.pubsub.listeners.SyncQueueListener.lambda$static$0(SyncQueueListener.java:113)
        at java.base/java.lang.Thread.run(Thread.java:842)

Need to determine where to address the problem. Switching back to JDK 11 boots fine. Not sure if this is caused by a plugin or a configuration that is incompatible with JDK 17. All agents/nodes are running the same version of JDK, but we didn't have any connecting when the master was upgraded. Any assistance is appreciated.

Tried upgrading Java JDK 11 to JDK 17, expecting Jenkins to boot.


Solution

  • I hate to admit it, since this seems like an easy fix, but I found out what is causing the problem. I don't however know if there is a better way to solve then what I'm planning..

    Comparing the config.xml files under the Jenkins root folder on both servers, I noticed that the server that isn't booting has the following configuration for List View:

    <listView>
      <owner class="hudson" reference="../../.."/>
      <name>OSOFAQ</name>
      <filterExecutors>false</filterExecutors>
      <filterQueue>false</filterQueue>
      <properties class="hudson.model.View$PropertyList"/>
      <jobNames>
        <comparator class="hudson.util.CaseInsensitiveComparator"/>
      </jobNames>
      <jobFilters/>
      <columns>
        <hudson.views.StatusColumn/>
        <hudson.views.WeatherColumn/>
        <hudson.views.JobColumn/>
        <hudson.views.LastSuccessColumn/>
        <hudson.views.LastFailureColumn/>
        <hudson.views.LastDurationColumn/>
        <hudson.views.BuildButtonColumn/>
      </columns>
      <includeRegex>.*FAQ.*</includeRegex>
      <recurse>true</recurse>
    </listView>
    

    When I added that to the other server, if failed to boot with the exact same error. I removed it and it booted fine. I went back to the server that has been failing to boot and removed this section from the config.xml. It booted fine. I guess something in this configuration is incompatible with JDK17, but works with JDK11. We don't have a hard dependency on that view, so we plan to remove as a permanent fix. I'll leave this open for comment in case there is a better way to solve this based on the configuration above.