Jenkins Environment Dashboard plug-in NoClassDefFoundError - jenkins

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.

Related

Jenkins System configuration error when saving

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.

Jenkins not running any jobs

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.

Can't run tests .idea/modules' does not exist

I have the spring-boot project with two modules
But Idea does not generate ./idea/modules folders those when I am trying to run tests I got next error
' Cannot start process, the working directory /home/../my_project_name/.idea/modules' does not exist
Reimport or rebuild the whole project not solve the issue.
It seems to be a confirmed issue for Intellij IDEA 2018: see this thread. The recommended solution worked fine for me when I was stuck with running unit tests:
As a workaround please manually change the value from $MODULE_DIR$ to %MODULE_WORKING_DIR% for 'Working Directory' in Run/Debug configuration.
To change it for all new projects please update Default Run/Debug Configuration.
Hope that helps you as well.

Quartz versioning issue with jboss

I m having quartz 1.7.3 in .grails/plugins folder in development environment
where in grails/web-inf/lib i have quartz-1.8.4.jar version
It works properly in development sts 3.1.0 IDE version
When i moved the same to production environment by creating war directory in the war folder it includes both 1.7.3 and quartz-1.8.4.jar files at .war/web-inf/lib/
where in jboss/server/default/lib contains quartz.jar (i.e. 1.5.2 comes with by default jboss)
now i m facing issue in invoking quartz jobs on start up and afterwards
same thing is working without changing anything in other server only i m facing the compatibility after putting logs in config.groovy i came to know the error.
I tried to put one jar from 1.7 or 1.8 in web-inf/lib still didn't worked
I did put the 1.5.2 version in web-inf/lib folder still i m facing compatibility issue
Any idea/suggestions
If i remember,
You need to check the quatz tables in the db, may in the other server ther not exist in the db or somting like that..
Tables are starting QURTZ_?
There is somting like 5-7 tables in the db.
There was versioning issue as more than one jar of diff versions were getting conflicting came to know after switching to logging in the system. As there were one more jar included in jboss-web-deplyer/lib directory after removing that jar the problem got resolved.
Thanks for the help.

Grails JBOSSAS Plugin -- How To get it To Work?

Newbie Question:
I've been required to deploy a grails app to jboss 5. I'm having a hell of a time figuring out how to take advantage of the grails jbossas plugin. I've followed the documentation as best as I know how, but I get the same exceptions just as if the plugin was never there.
Here's the documentation i've been following:
http://grails-plugins.github.com/grails-jbossas/docs/manual/guide/2%20Usage.html
I've added the plugin to the BuildConfig.groovy plugin{} closure. I then called grails war. Nothing happens and my war deploy bombs out.
Could somebody give a newbie a little hand holding to get this plugin to work? Unfortunately, I'm finding the documentation to be wanting in the regard of actually telling you how to use it, or when the plugin will do its magic.
UPDATE:
My environment:
Mac OS X Lion Dev machine
Grails 2.0.3
JBoss 5.1.0 -- running a Liferay instance.
Burt, I've done the following:
grails generate-jboss-deploy 5
grails war.
scp the generated war file to the deploy-jboss directory on my remote server.
Dutifully, jboss picked up the new war and attempted to deploy it. I'm getting the following (now dreaded) exception:
Caused by: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator
Per the usage instructions, I've modified Datasource.groovy's hibernate configuration:
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = true
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
validator.apply_to_ddl = false
validator.autoregister_listeners = false
}
The only file that seems to have been modified or created by running the generate-jboss-delpoy 5 script is WEB-INF/jboss-web.xml. It's contents are:
<jboss-web>
<class-loading java2ClassLoadingCompliance="false">
<loader-repository>
sappi-label:loader=sappi-label.war
<loader-repository-config>java2ParentDelegation=false</loader-repository-config>
</loader-repository>
</class-loading>
</jboss-web>
I confirmed that the jboss-web.xml file is present in the generated war file (exploded, then checked the directory).
Burt: what files other than jboss-web.xml should have been altered?
UPDATE (Again):
I don't think there's anything wrong with the jbossas plugin. I've done more testing and see that the plugin is doing what it is supposed to do: remove jars, put in jboss-web.xml. I haven't been able to confirm that it modifies the hibernate config, but I assume it is. I think the problem lies within the server I'm attempting to deploy to, a Liferay instance.
regardless of what I'm doing I get an exception saying that slf4j was unable to load successfully. Nothing more, nothing less. I'll keep whacking away at the problem, but it is out of scope of my original question. Burt, thanks for your help. If you have any ideas about why slf4j vomits in a Liferay/jboss environment, please let me know.
Regards.
Thanks!
I guess I didn't make it clear that you need to run the generate-jboss-deploy script, passing in the major version of JBoss that you're using, so in your case generate-jboss-deploy 5. I've updated the docs to describe this.
If this doesn't help please update your question with some indication of what the errors that you're seeing are.

Resources