Too many WorkflowScheme schemes found for Project
症状
Attempting to access a project's Workflow Scheme configuration throws a 500 Error page.
atlassian-jira.log
に次のメッセージが表示される。
2014-04-01 09:31:45,531 http-bio-8081-exec-2 ERROR [500ErrorPage.jsp] Exception caught in 500 page Too many WorkflowScheme schemes found for Project XXXXX
java.lang.IllegalStateException: Too many WorkflowScheme schemes found for Project XXXXX
at com.atlassian.jira.scheme.AbstractSchemeManager.getSchemeFor(AbstractSchemeManager.java:232)
at com.atlassian.jira.bc.project.DefaultProjectService.deleteProject(DefaultProjectService.java:715)
at com.atlassian.jira.web.action.project.DeleteProject.doExecute(DeleteProject.java:64)
at webwork.action.ActionSupport.execute(ActionSupport.java:165)
...
原因
There are multiple workflow schemes associated to the JIRA project. (This is illegal) This can be seen rather clearly by delving into the source code:
public Scheme getSchemeFor(Project project)
{
try
{
final List<GenericValue> schemes = getSchemes(project.getGenericValue());
if (schemes.isEmpty())
{
return null;
}
if (schemes.size() > 1)
{
throw new IllegalStateException("Too many " + getSchemeEntityName() + " schemes found for Project " + project.getKey());
}
return schemeFactory.getScheme(schemes.iterator().next());
}
catch (GenericEntityException ex)
{
throw new DataAccessException(ex);
}
}
It can be seen that JIRA will throw the "Too many WorkflowScheme schemes" error when it returns more than 1 scheme.
ソリューション
Start by identifying all the workflow schemes associated to the project. Run the following SQL query:
SELECT * FROM nodeassociation WHERE SINK_NODE_ENTITY = 'WorkflowScheme' AND SOURCE_NODE_ID = (SELECT ID FROM project WHERE pkey = 'XXXXX');
- The SQL query above will pull all Workflow Schemes associated to project with key XXXXX. (replace with whatever project key you need)
- Other schemes can be discovered as well by changing the SINK_NODE_ENTITY to other values, such as 'PermissionScheme', 'WorkflowScheme' and 'NotificationScheme'.
If the SQL returns two rows, like in below, then one of it needs to be deleted as its causing the error.
SOURCE_NODE_ID SOURCE_NODE_ENTITY SINK_NODE_ID SINK_NODE_ENTITY ASSOCIATION_TYPE SEQUENCE 10600 Project 10200 WorkflowScheme ProjectScheme NULL 10600 Project 10201 WorkflowScheme ProjectScheme NULL
Before deleting one of the rows above, bulk-move all the issues in the affected project to another temporary project, and then execute the delete query:
DELETE FROM nodeassociation WHERE SINK_NODE_ENTITY = 'WorkflowScheme' AND SOURCE_NODE_ID = 10600 AND SINK_NODE_ID = 10200 AND ASSOCIATION_TYPE = 'ProjectScheme';
This is an example query following the results of the previous SQL in STEP 4.
Once the query is executed, restart JIRA.
警告
Always ensure you have a database backup before performing a delete query like in the above.