Consistent multiple NullPointerException when publishing analysis results, example follows (Checkstyle, PMD, Clover etc.)
12:45:27 [CHECKSTYLE] Collecting checkstyle analysis files... 12:45:27 [CHECKSTYLE] Finding all files that match the pattern build/logs/checkstyle.xml 12:45:27 ERROR: Publisher hudson.plugins.checkstyle.CheckStylePublisher aborted due to exception 12:45:27 java.lang.NullPointerException 12:45:27 at hudson.model.Run.getRootDir(Run.java:961) 12:45:27 at hudson.plugins.analysis.core.BuildResult.getDataFile(BuildResult.java:498) 12:45:27 at hudson.plugins.analysis.core.BuildResult.loadResult(BuildResult.java:913) 12:45:27 at hudson.plugins.analysis.core.BuildResult.getProject(BuildResult.java:893) 12:45:27 at hudson.plugins.analysis.core.BuildResult.getContainer(BuildResult.java:1037) 12:45:27 at hudson.plugins.analysis.core.BuildHistory.getReferenceAnnotations(BuildHistory.java:86) 12:45:27 at hudson.plugins.analysis.core.BuildResult.initialize(BuildResult.java:264) 12:45:27 at hudson.plugins.analysis.core.BuildResult.<init>(BuildResult.java:217) 12:45:27 at hudson.plugins.checkstyle.CheckStyleResult.<init>(CheckStyleResult.java:61) 12:45:27 at hudson.plugins.checkstyle.CheckStyleResult.<init>(CheckStyleResult.java:56) 12:45:27 at hudson.plugins.checkstyle.CheckStyleResult.<init>(CheckStyleResult.java:36) 12:45:27 at hudson.plugins.checkstyle.CheckStylePublisher.perform(CheckStylePublisher.java:146) 12:45:27 at hudson.plugins.analysis.core.HealthAwarePublisher.perform(HealthAwarePublisher.java:144) 12:45:27 at hudson.plugins.analysis.core.HealthAwareRecorder.perform(HealthAwareRecorder.java:333) 12:45:27 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) 12:45:27 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:780) 12:45:27 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752) 12:45:27 at hudson.model.Build$BuildExecution.post2(Build.java:183) 12:45:27 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:705) 12:45:27 at hudson.model.Run.execute(Run.java:1617) 12:45:27 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) 12:45:27 at hudson.model.ResourceController.execute(ResourceController.java:88) 12:45:27 at hudson.model.Executor.run(Executor.java:237) 12:45:27 [PMD] Collecting PMD analysis files... 12:45:27 [PMD] Finding all files that match the pattern build/logs/pmd.xml 12:45:27 [PMD] Parsing 1 files in /home/jenkins/workspace/docs-dev-unit-test 12:45:27 [PMD] Successfully parsed file /home/jenkins/workspace/docs-dev-unit-test/build/logs/pmd.xml of module with 10 warnings. 12:45:27 ERROR: Publisher hudson.plugins.pmd.PmdPublisher aborted due to exception 12:45:27 java.lang.NullPointerException 12:45:27 at hudson.model.Run.getRootDir(Run.java:961) 12:45:27 at hudson.plugins.analysis.core.BuildResult.getDataFile(BuildResult.java:498) 12:45:27 at hudson.plugins.analysis.core.BuildResult.loadResult(BuildResult.java:913) 12:45:27 at hudson.plugins.analysis.core.BuildResult.getProject(BuildResult.java:893) 12:45:27 at hudson.plugins.analysis.core.BuildResult.getContainer(BuildResult.java:1037) 12:45:27 at hudson.plugins.analysis.core.BuildHistory.getReferenceAnnotations(BuildHistory.java:86) 12:45:27 at hudson.plugins.analysis.core.BuildResult.initialize(BuildResult.java:264) 12:45:27 at hudson.plugins.analysis.core.BuildResult.<init>(BuildResult.java:217) 12:45:27 at hudson.plugins.pmd.PmdResult.<init>(PmdResult.java:61) 12:45:27 at hudson.plugins.pmd.PmdResult.<init>(PmdResult.java:56) 12:45:27 at hudson.plugins.pmd.PmdResult.<init>(PmdResult.java:36) 12:45:27 at hudson.plugins.pmd.PmdPublisher.perform(PmdPublisher.java:142) 12:45:27 at hudson.plugins.analysis.core.HealthAwarePublisher.perform(HealthAwarePublisher.java:144) 12:45:27 at hudson.plugins.analysis.core.HealthAwareRecorder.perform(HealthAwareRecorder.java:333) 12:45:27 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) 12:45:27 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:780) 12:45:27 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752) 12:45:27 at hudson.model.Build$BuildExecution.post2(Build.java:183) 12:45:27 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:705) 12:45:27 at hudson.model.Run.execute(Run.java:1617) 12:45:27 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) 12:45:27 at hudson.model.ResourceController.execute(ResourceController.java:88) 12:45:27 at hudson.model.Executor.run(Executor.java:237) 12:45:27 [DRY] Collecting duplicate code analysis files... 12:45:28 [DRY] Finding all files that match the pattern build/logs/pmd-cpd.xml 12:45:28 [DRY] Parsing 1 files in /home/jenkins/workspace/docs-dev-unit-test 12:45:28 [DRY] Successfully parsed file /home/jenkins/workspace/docs-dev-unit-test/build/logs/pmd-cpd.xml of module with 5 warnings. 12:45:28 ERROR: Publisher hudson.plugins.dry.DryPublisher aborted due to exception 12:45:28 java.lang.NullPointerException 12:45:28 at hudson.model.Run.getRootDir(Run.java:961) 12:45:28 at hudson.plugins.analysis.core.BuildResult.getDataFile(BuildResult.java:498) 12:45:28 at hudson.plugins.analysis.core.BuildResult.loadResult(BuildResult.java:913) 12:45:28 at hudson.plugins.analysis.core.BuildResult.getProject(BuildResult.java:893) 12:45:28 at hudson.plugins.analysis.core.BuildResult.getContainer(BuildResult.java:1037) 12:45:28 at hudson.plugins.analysis.core.BuildHistory.getReferenceAnnotations(BuildHistory.java:86) 12:45:28 at hudson.plugins.analysis.core.BuildResult.initialize(BuildResult.java:264) 12:45:28 at hudson.plugins.analysis.core.BuildResult.<init>(BuildResult.java:217) 12:45:28 at hudson.plugins.dry.DryResult.<init>(DryResult.java:61) 12:45:28 at hudson.plugins.dry.DryResult.<init>(DryResult.java:56) 12:45:28 at hudson.plugins.dry.DryResult.<init>(DryResult.java:36) 12:45:28 at hudson.plugins.dry.DryPublisher.perform(DryPublisher.java:178) 12:45:28 at hudson.plugins.analysis.core.HealthAwarePublisher.perform(HealthAwarePublisher.java:144) 12:45:28 at hudson.plugins.analysis.core.HealthAwareRecorder.perform(HealthAwareRecorder.java:333) 12:45:28 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) 12:45:28 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:780) 12:45:28 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752) 12:45:28 at hudson.model.Build$BuildExecution.post2(Build.java:183) 12:45:28 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:705) 12:45:28 at hudson.model.Run.execute(Run.java:1617) 12:45:28 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) 12:45:28 at hudson.model.ResourceController.execute(ResourceController.java:88) 12:45:28 at hudson.model.Executor.run(Executor.java:237)
Investigation results:
Seems that the member
protected transient final JobT project;
is null when calling
/** * Root directory of this {@link Run} on the master. * * Files related to this {@link Run} should be stored below this directory. */ public File getRootDir() { return new File(project.getBuildDir(),getId()); }
Since the member is restored using XStream during startup, there must be a problem with the serialization of the config.xml or build.xml file.
- is duplicated by
-
JENKINS-45846 NullPointerException in hudson.plugins.analysis.core.BuildResult
- Resolved