Cannot access Plan Configuration - Retrieving PROJ-PLAN threw java.lang.NullPointerException, aborting
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
An Internal Server Error is displayed with a NullPointerException
when trying to view the following pages in Bamboo:
- The configuration page of a specific plan
- Bamboo dashboard
In the atlassian-bamboo.log
file the following exception can be found:
# Bamboo 5.4.2
2015-06-29 08:46:42,302 INFO [http-apr-8085-exec-14] [RetryingTaskExecutor] Task 'Retrieving PROJ-PLAN' threw java.lang.NullPointerException, aborting.
2015-06-29 08:46:42,306 ERROR [http-apr-8085-exec-14] [ExceptionMappingInterceptor] java.lang.NullPointerException
java.lang.RuntimeException: java.lang.NullPointerException
at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:120)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.runTask(RetryingTaskExecutor.java:88)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:191)
at com.atlassian.bamboo.plan.cache.ImmutablePlanManagerImpl.getPlanByKey(ImmutablePlanManagerImpl.java:129)
...
# Bamboo 5.9.1
2015-08-04 17:36:45,938 INFO [AtlassianEvent::0-BAM::EVENTS:pool-3-thread-11] [RetryingTaskExecutor] Task 'Retrieving PROJ-PLAN' threw java.lang.NullPointerException, aborting.
2015-08-04 17:36:45,940 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-3-thread-11] [AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event [com.atlassian.bamboo.event.BuildFinishedEvent[source=com.atlassian.bamboo.build.DefaultBuildExecutionManager@54ef15a9] job=PROJ-PLAN-JOB1 #1] from the invoker [LegacyListenerInvoker{eventListener=com.atlassian.bamboo.notification.buildcompleted.BuildCompletedNotificationListener@61dfbcf}]
java.lang.RuntimeException: java.lang.NullPointerException
at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:120)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.runTask(RetryingTaskExecutor.java:88)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:191)
at com.atlassian.bamboo.plan.cache.ImmutablePlanManagerImpl.getPlanByKey(ImmutablePlanManagerImpl.java:125)
Cause
When changing the order of stages in a plan the database does not get updated correctly resulting in duplicated values for their order number. This problem typically arises when a user is rearranging multiple stages in quick succession. This behavior has been recognized as the following bug:
BAM-12217 - Getting issue details... STATUS
Workaround
On instances with large amounts of data (plans, stages, jobs) or on instances that are generally performing a little more slowly, the problem can usually be prevented by waiting a little bit (1-2 seconds) before rearranging the next stage. This allows Bamboo to commit the change of the previous step first.
Resolution
In order to determine if you are experiencing this issue, please:
- Stop Bamboo.
- Run the following query to determine whether your stages are out of sequence (in the query, replace
PROJ_PLAN%
with the name of the plan that appears in the error message):
SELECT *
FROM build as job
join chain_stage as cs
on job.build_id = cs.build_id
WHERE job.full_key like 'PROJ-PLAN%'
The query should produce output similar to the one below:
10846459,CHAIN,23:36.8,23:29.9,PROJ-PLAN,PLAN,Default Job,1,46,47,0,0,589825,null,10878990,null,null,null,null,10977375,null,null,Name,Description,0,0,10846459,0
10846459,CHAIN,23:36.8,23:29.9,PROJ-PLAN,PLAN,Default Job,1,46,47,0,0,589825,null,10878990,null,null,null,null,10977376,null,null,Name,Description,0,0,10846459,1
10846459,CHAIN,23:36.8,23:29.9,PROJ-PLAN,PLAN,Default Job,1,46,47,0,0,589825,null,10878990,null,null,null,null,10977377,null,null,Name,Description,0,0,10846459,2
10846459,CHAIN,23:36.8,23:29.9,PROJ-PLAN,PLAN,Default Job,1,46,47,0,0,589825,null,10878990,null,null,null,null,10977378,null,null,Name,Description,0,0,10846459,3
10846459,CHAIN,23:36.8,23:29.9,PROJ-PLAN,PLAN,Default Job,1,46,47,0,0,589825,null,10878990,null,null,null,null,10977379,null,null,Name,Description,0,0,10846459,3
10846459,CHAIN,23:36.8,23:29.9,PROJ-PLAN,PLAN,Default Job,1,46,47,0,0,589825,null,10878990,null,null,null,null,16482330,null,null,Name,Description,0,0,10846459,5
The last column in each row indicates the relative position of the stages in the plan, and they should be in sequence. In the example above you can see that there are two rows where the value is 3
and there is no row with a value of 4
. This is the cause of the exception.
To correct this situation, you will need to manually update the database:
Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
- Decide which of the stages with duplicated list positions is currently correct and which one needs to be fixed.
- Identify the value of the first column of the row (from the query result set representing the stage you want to fix) and replace
<stageId>
in the query below with its value. - Replace
<newPosition>
in the query below with the list position value that is missing from the sequence (in the example above this is "4"). Run the following query:
UPDATE chain_stage SET list_position=<newPosition> WHERE stage_id=<stageId>;
- Start Bamboo