I've managed to break Jenkins while trying to fix some other problems. Now whenever I run a job it immediately fails with the following error:
java.lang.NullPointerException
at java.util.TreeMap.putAll(TreeMap.java:313)
at hudson.slaves.EnvironmentVariablesNodeProperty.buildEnvVars(EnvironmentVariablesNodeProperty.java:85)
at hudson.model.Computer.buildEnvironment(Computer.java:1195)
at hudson.model.Job.getEnvironment(Job.java:385)
at hudson.model.Run.getEnvironment(Run.java:2419)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.getEnvironment(WorkflowRun.java:500)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:112)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:68)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:310)
at hudson.model.ResourceController.execute(ResourceController.java:99)
at hudson.model.Executor.run(Executor.java:432)
Finished: FAILURE
I found this answer Jenkins - Problem: hudson.model.Queue$MaintainTask failed but it suggests rewriting the config.xml file. When I do that and reload config from the disk, config.xml files gets overwritten by jenkins. I have upgraded jenkins to the latest available version and also updated most of the plugins. I also tried to add back the environment variables through the UI but doing that throws the following exception:
2022-01-06 17:21:50.894+0000 [id=10] WARNING o.e.j.s.h.ContextHandler$Context#log: Error while serving https://<jenkins-url>:<port>/configSubmit
java.lang.ClassCastException: java.lang.Integer cannot be cast to hudson.model.Describable
at hudson.util.DescribableList.get(DescribableList.java:126)
at hudson.util.DescribableList.rebuild(DescribableList.java:168)
at jenkins.model.GlobalNodePropertiesConfiguration.configure(GlobalNodePropertiesConfiguration.java:25)
at jenkins.model.Jenkins.configureDescriptor(Jenkins.java:3846)
at jenkins.model.Jenkins.doConfigSubmit(Jenkins.java:3810)
at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)
Caused: java.lang.reflect.InvocationTargetException
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:400)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212)
at org.kohsuke.stapler.SelectionInterceptedFunction$Adapter.invoke(SelectionInterceptedFunction.java:36)
which looks similar to the first exception where it is unable to recognize the Integer field. How can I get this configuration fixed?
How it started
I had several scheduled jobs running perfectly fine. But suddenly after weeks of successful runs they started to fail without any obvious reason. But they were still running to a certain point. I also had a plugin installed called build-monitor-plugin but after installing that I had not restarted jenkins. I decided to restart jenkins to see if that resolves the problem but that landed me into a different set of issues and I never got to figure out why the jobs started to fail after running successfully for several weeks. To find that out I have to resolve the NPE issue first (which I described in the beginning). The folder that had all my jobs now shows a broken view:
However, I am still able to access the jobs using a direct url to them. This folder had a view added to it using the build-monitor-plugin and I suspected it messed up something after the restart. So I uninstalled the plugin but that did not fix the view. I have also manually removed all files related to this plugin but that also does not help. When I visit the folder I see following error in the log:
2022-01-06 05:29:47.232+0000 [id=87] WARNING h.i.i.InstallUncaughtExceptionHandler#handleException: Caught unhandled exception with ID cb5bdf8c-2a97-4360-8f80-95df2c5c719b
org.apache.commons.jelly.JellyTagException: jar:file:/app/jenkins/war/WEB-INF/lib/jenkins-core-2.319.1.jar!/hudson/model/View/index.jelly:42:43: <st:include> org.apache.commons.jelly.JellyTagException: jar:file:/app/jenkins/war/WEB-INF/lib/jenkins-core-2.319.1.jar!/lib/hudson/projectView.jelly:67:24: <d:invokeBody> `java.lang.NullPointerException
at org.apache.commons.jelly.impl.TagScript.handleException(TagScript.java:726)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:281)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)`
Finally managed to fix both issues.
What happened?
Sequence of installing the plugin-in build-monitor-plugin, restarting Jenkins and then uninstalling the plug-in left some of the files in Jenkins in a corrupted state. A state from which Jenkins version 2.263.3 was unable to recover even though it kept on recreating the files but every time it was creating the same corrupted files again.
Corrupted Files
There were two files that got corrupted and both are named config.xml. First one is in the top most level directory of Jenkins. It is supposed to be as follows in case you have environment variables:
<globalNodeProperties>
<hudson.slaves.EnvironmentVariablesNodeProperty>
<envVars serialization="custom">
<unserializable-parents/>
<tree-map>
<default>
<comparator class="java.lang.String$CaseInsensitiveComparator"/>
</default>
<int>2</int> <!-- This number indicates how many key/value pairs will follow it -->
<string></string>
<string></string>
...
</tree-map>
</envVars>
</hudson.slaves.EnvironmentVariablesNodeProperty>
</globalNodeProperties>
Something similar was also suggested in Jenkins - Problem: hudson.model.Queue$MaintainTask failed but the value of <comparator> class mentioned there did not work. I figured out the correct value by installing a separate instance of Jenkins and comparing the new config.xml with the old one.
Similarly the other config.xml that was broken was for the folder which was not showing up properly as can be seen in question. For that I created another folder and compared it's config.xml with the broken one and found following two lines missing from the <folderViews>:
...
<folderViews>
...
<primaryView>All</primaryView>
<tabBar class="hudson.views.DefaultViewsTabBar"/>
</folderViews>
...
Adding these two lines resolved the issue.
Piggybacking on this answer since we just had a very similar error pop up and we had the build-monitor-plugin plugin installed, too:
java.lang.NullPointerException
at java.util.TreeMap.putAll(Unknown Source)
at hudson.slaves.EnvironmentVariablesNodeProperty.buildEnvVars(EnvironmentVariablesNodeProperty.java:85)
at hudson.model.Computer.buildEnvironment(Computer.java:1210)
at hudson.model.Job.getEnvironment(Job.java:385)
at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:334)
at hudson.model.Run.getEnvironment(Run.java:2419)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:943)
at CUSTOM_PLUGIN
I immediately thought our custom plugin was to blame but reverting to the previous stable version did not change this behavior. Then, finding #Syed Ali's answer, I looked at our config.xml files but they seemed fine.
The problem was that, in the Configuration of the administrative section, the Environment Variables section's checkbox was checked but no key-value pairs had been added. For some reason, unchecking that option fixed any related problem.
Related
An instance of Jenkins started not saving changes made under 'Manage Jenkins > System Configuration'.
In an attempt to solve it, I have recently upgraded to Jenkins 2.346.3 (including all the plugins).
Unfortunately, this behavior still persists and the System Log only shows:
Error while serving http://<jenkins_url>/configSubmit
java.lang.ClassCastException: java.lang.Integer cannot be cast to hudson.model.Describable
at hudson.util.DescribableList.get(DescribableList.java:128)
at hudson.util.DescribableList.rebuild(DescribableList.java:170)
at jenkins.model.GlobalNodePropertiesConfiguration.configure(GlobalNodePropertiesConfiguration.java:24)
at jenkins.model.Jenkins.configureDescriptor(Jenkins.java:4017)
at jenkins.model.Jenkins.doConfigSubmit(Jenkins.java:3981)
at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:397)
Caused: java.lang.reflect.InvocationTargetException
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:401)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:409)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:207)
<snippet>
Any idea on the possible cause?
UPDATE
After 2 attempts on restarting Jenkins without the config.xml, I succeeded in having Jenkins 'Manage Jenkins > System Configuration' behaving as expected.
After the first attempt, I reverted to the old configuration file as all the security related configurations were missing and I ended up raising the ticket https://issues.jenkins.io/browse/JENKINS-69548
On the 2nd attempt, I did what I described in the ticket comment https://issues.jenkins.io/browse/JENKINS-69548?focusedCommentId=430091&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-430091 (i.e. re-introducing the security-related configurations)
You probably have a corrupted config.xml from your old installation. Try deleting the config.xml(Back it up) located at $JENKINS_HOME(if you have not changed the default JENKINS_HOME in most cases it will be at USER_HOME/.jenkins(~/.jenkins)) and restarting Jenkins. If it's successful you can start reconfiguring or moving the configs from there.
This is the second TFSVC repository (one on AzureDevOps and one onpremise) that I try to get using tee-clc and crashes with this exception java.lang.IllegalArgumentException: update.isFullyPopulated(setFileTimeToCheckin)
This is the command I am trying to execute after creating the workspace and mapping it
tf get -recursive -all $/path
It starts downloading and then crashes always on a specific file.
Already opened an issue on github without luck: https://github.com/Microsoft/team-explorer-everywhere/issues/291
Does anybody have a hint? Thanks!
I've been using the Environment Dashboard plug-in for quite a while now... I believe someone updated other plug-ins or changed the configuration, or even accidentally deleted the h2 DB. Ever since then I can't get the environment dashboard to work.
When I try creating a new dashboard, I get:
javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class org.jenkinsci.plugins.environmentdashboard.EnvDashboardView
I tried removing and re-adding the plug-in a few times, including manually. I also tried extracting classes.jar but no luck. Any ideas?
Just solved it here a couple of hours ago.
Delete (backup it up before) the following environment dashboard files from JENKINS_HOME: jenkins_dashboard.mv.db jenkins_dashboard.trace.db jenkins_dashboard.trace.db.old org.jenkinsci.plugins.environmentdashboard.DashboardBuilder.xml.
Re-install the plugin.
Hope it works for you as well.
I have jenkins v 1.580 installed on windows.
All my jobs were working fine until afternoon but all of a sudden all the jobs started failing with the following error,(The only error)
FATAL: (class: org/apache/commons/codec/binary/Base64OutputStream, method: signature: (Ljava/io/OutputStream;ZI[B)V) Incompatible argument to function
FATAL: (class: org/apache/commons/codec/binary/Base64OutputStream, method: signature: (Ljava/io/OutputStream;ZI[B)V) Incompatible argument to function
Finished: null
The only thing i found to happen in the afternoon was a windows security update but that also I was able to get uninstalled with the help of IT.
(I have close to 50 jobs running. Is there any limitation on number of jobs)
Can anyone tell me what could be wrong here?
Following the error snippet I can see from jenkins.error,
a user in error attempting to specify a java: URL name in a non-J2EE client or server environment. Throwing
Caused by: com.thoughtworks.xstream.io.StreamException: : only whitespace content allowed before start tag and not \u0
(position: START_DOCUMENT seen \u0... #1:1)
Caused by: org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not \u0 (position:
START_DOCUMENT seen \u0... #1:1)
Should I go for reinstallation of jenkins?
Thanks in advance.
Sakthivel C
Are you using fingerprint plugin? It appears as if fingerprint files were corrupted.
Delete the directory "fingerprints" from JENKINS_HOME and restart your Jenkins to resolve the issue.
If that doesn't work, paste the exact error log here.
I have restarted Jenkins using the following:
service jenkins stop
service jenkins start
Followed to that I can see some jobs are missing from the GUI.
I have also tried to go the job URL using http://<jenkins_url>/job/<JOBNAME>/
Unfortunately it is also giving:
HTTP ERROR 404
Problem accessing /job/<JOBNAME>/. Reason:
Not Found
Powered by Jetty://
Also performed Doing a Reload Configuration from Disk with no luck.
I checked the config.xml file and I can see it is corrupted. The size of config.xml file is around 110 MB. Why this file got corrupted? How to trace it.
Can anyone give me any pointer how to troubleshoot this problem?
I had the same symptoms, but I'm using a homebrew installation of Jenkins.
The Jenkins machine was shut down improperly, likely from a power outage, so when it came back up it was basically a clean instance. No jobs and no system configurations.
The following solution isn't for your exact use case, but it does solve the problem for some users who return to Jenkins to find it without any jobs.
The solution basically involves you checking to see if you have started the Jenkins service incorrectly or from the wrong place.
...
On to the specific homebrew issue:
For whatever reason, the homebrew.mxcl.jenkins.plist file was found in ~/Library/LaunchDaemons/
It belongs in ~/Library/LaunchAgents/ only.
If this happens, it can be solved as follows
Stop the service:
sudo launchctl unload ~/Library/LaunchDaemons/homebrew.mxcl.jenkins.plist
Reload the correct file, located in ~/Library/LaunchAgents/ by trying the following line in case it's running:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
Note: the above line may yell at you if it's not running, which is ok.
Start it up again:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
If all looks good when Jenkins loads again, you can and should
delete homebrew.mxcl.jenkins.plist in ~/Library/LaunchDaemons/:
sudo rm ~/Library/LaunchDaemons/homebrew.mxcl.jenkins.plist