Creating new project fails due to java.lang.NullPointerException error

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Creating a new project will result in the UI error message below: 

Unable to instantiate Action, com.atlassian.crucible.actions.admin.project.NewProjectAction, defined for 'newProject' in namespace '/admin'Error creating bean with name 'com.atlassian.crucible.actions.admin.project.NewProjectAction': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.crucible.actions.admin.project.NewProjectAction]: Constructor threw exception; nested exception is java.lang.NullPointerException
Error creating bean with name 'com.atlassian.crucible.actions.admin.project.NewProjectAction': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.crucible.actions.admin.project.NewProjectAction]: Constructor threw exception; nested exception is java.lang.NullPointerException
Could not instantiate bean class [com.atlassian.crucible.actions.admin.project.NewProjectAction]: Constructor threw exception; nested exception is java.lang.NullPointerException

And from logs: 

2012-07-25 16:31:01,492 ERROR [btpool0-12 ] fisheye.console PermissionManager-getDefaultPermissionScheme - No default permission scheme exists
2012-07-25 16:31:01,493 ERROR [btpool0-12 ] fisheye.app TotalityFilter-logExceptionDetails - Exception "Unable to instantiate Action, com.atlassian.crucible.actions.admin.project.NewProjectAction,  defined for 'newProject' in namespace '/admin'Error creating bean with name 'com.atlassian.crucible.actions.admin.project.NewProjectAction': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.crucible.actions.admin.project.NewProjectAction]: Constructor threw exception; nested exception is java.lang.NullPointerException" (javax.servlet.ServletException) while processing "/admin/newProject.do" (Referer:"http://fisheye:8081/admin/listProjects.do")
javax.servlet.ServletException: Unable to instantiate Action, com.atlassian.crucible.actions.admin.project.NewProjectAction,  defined for 'newProject' in namespace '/admin'Error creating bean with name 'com.atlassian.crucible.actions.admin.project.NewProjectAction': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.crucible.actions.admin.project.NewProjectAction]: Constructor threw exception; nested exception is java.lang.NullPointerException

Cause

  1. During Fisheye installation the default Fisheye project was not created and application uses the default project like a model to create new projects.
  2. Another cause would be a deletion or renaming of the "agile" permission scheme. The code looks either for a permission scheme named agile, or a permission scheme numbered id 1 (cru_ps_id = 1) If neither exist, when it hits the null value there, it throws a NullPointerException. To check it this is the case you can query the permissions table:

    select * from cru_perm_scheme;


Resolution

Re-create the default permission scheme (only in the case that there is no other conflict with id 1, or default name already existing in the database)  by doing the following:

  1. Backup your Crucible instance for safety before shutting down.
  2. Execute the SQL queries below:
INSERT INTO cru_perm_scheme VALUES(1,'default');
INSERT INTO cru_ps_all_user VALUES(1,'action:createReview');
INSERT INTO cru_ps_all_user VALUES(1,'action:viewReview');
INSERT INTO cru_ps_review_role VALUES(1,'Author','action:commentOnReview');
INSERT INTO cru_ps_review_role VALUES(1,'Author','action:viewReview');
INSERT INTO cru_ps_review_role VALUES(1,'Creator','action:abandonReview');
INSERT INTO cru_ps_review_role VALUES(1,'Creator','action:commentOnReview');
INSERT INTO cru_ps_review_role VALUES(1,'Creator','action:deleteReview');
INSERT INTO cru_ps_review_role VALUES(1,'Creator','action:modifyReviewFiles');
INSERT INTO cru_ps_review_role VALUES(1,'Creator','action:recoverReview');
INSERT INTO cru_ps_review_role VALUES(1,'Creator','action:submitReview');
INSERT INTO cru_ps_review_role VALUES(1,'Creator','action:viewReview');
INSERT INTO cru_ps_review_role VALUES(1,'Moderator','action:abandonReview');
INSERT INTO cru_ps_review_role VALUES(1,'Moderator','action:approveReview');
INSERT INTO cru_ps_review_role VALUES(1,'Moderator','action:closeReview');
INSERT INTO cru_ps_review_role VALUES(1,'Moderator','action:commentOnReview');
INSERT INTO cru_ps_review_role VALUES(1,'Moderator','action:deleteReview');
INSERT INTO cru_ps_review_role VALUES(1,'Moderator','action:modifyReviewFiles');
INSERT INTO cru_ps_review_role VALUES(1,'Moderator','action:recoverReview');
INSERT INTO cru_ps_review_role VALUES(1,'Moderator','action:rejectReview');
INSERT INTO cru_ps_review_role VALUES(1,'Moderator','action:reopenReview');
INSERT INTO cru_ps_review_role VALUES(1,'Moderator','action:summarizeReview');
INSERT INTO cru_ps_review_role VALUES(1,'Moderator','action:viewReview');
INSERT INTO cru_ps_review_role VALUES(1,'Reviewer','action:commentOnReview');
INSERT INTO cru_ps_review_role VALUES(1,'Reviewer','action:completeReview');
INSERT INTO cru_ps_review_role VALUES(1,'Reviewer','action:uncompleteReview');
INSERT INTO cru_ps_review_role VALUES(1,'Reviewer','action:viewReview');
COMMIT;


Alternatively, if the cru_perm_scheme table contains an entry such as agile(copy 1) you can safely rename it back to agile in the UI by:

  1. Go to Administration > Security Settings > Permission Schemes
  2. If you see a scheme named similar to "agile(copy 1)" click on the name
  3. There should be a box/option to rename the scheme back to agile

Last modified on Nov 12, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.