Cannot save workItem stale data exception
When I trying to add some comments to a workItem in RTC using Java API, it always popped up the following error. Could anyone help me how to avoid such kind of error? Thanks.
09-Dec-2015 14:11:04.441 WARNING [EjbTimerPool - 1] com.ibm.isvt.defects.service.RtcSummaryService.addComments FAIL: Exception saving work item com.ibm.team.workitem.common.model.MultiStaleDataException: Stale Data at com.ibm.team.workitem.common.internal.util.Utils.checkSaveResult(Utils.java:264) at com.ibm.team.workitem.client.internal.WorkItemWorkingCopyRegistry.saveWorkItems(WorkItemWorkingCopyRegistry.java:2321) at com.ibm.team.workitem.client.internal.WorkItemWorkingCopyRegistry.saveAffected(WorkItemWorkingCopyRegistry.java:2203) at com.ibm.team.workitem.client.internal.WorkItemWorkingCopyRegistry.save(WorkItemWorkingCopyRegistry.java:2086) at com.ibm.team.workitem.client.internal.WorkItemWorkingCopyRegistry.save(WorkItemWorkingCopyRegistry.java:2047) at com.ibm.team.workitem.client.internal.WorkItemWorkingCopyManager.save(WorkItemWorkingCopyManager.java:122) at com.ibm.team.workitem.client.internal.WorkItemWorkingCopyImpl.save(WorkItemWorkingCopyImpl.java:233) at com.ibm.isvt.defects.rtc.WorkItemTransaction.addComments(WorkItemTransaction.java:166) at com.ibm.isvt.defects.service.RtcSummaryService.addComments(RtcSummaryService.java:127) at sun.reflect.GeneratedMethodAccessor471.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620)
09-Dec-2015 14:11:04.441 WARNING [EjbTimerPool - 1] com.ibm.isvt.defects.service.RtcSummaryService.addComments FAIL: Exception saving work item com.ibm.team.workitem.common.model.MultiStaleDataException: Stale Data at com.ibm.team.workitem.common.internal.util.Utils.checkSaveResult(Utils.java:264) at com.ibm.team.workitem.client.internal.WorkItemWorkingCopyRegistry.saveWorkItems(WorkItemWorkingCopyRegistry.java:2321) at com.ibm.team.workitem.client.internal.WorkItemWorkingCopyRegistry.saveAffected(WorkItemWorkingCopyRegistry.java:2203) at com.ibm.team.workitem.client.internal.WorkItemWorkingCopyRegistry.save(WorkItemWorkingCopyRegistry.java:2086) at com.ibm.team.workitem.client.internal.WorkItemWorkingCopyRegistry.save(WorkItemWorkingCopyRegistry.java:2047) at com.ibm.team.workitem.client.internal.WorkItemWorkingCopyManager.save(WorkItemWorkingCopyManager.java:122) at com.ibm.team.workitem.client.internal.WorkItemWorkingCopyImpl.save(WorkItemWorkingCopyImpl.java:233) at com.ibm.isvt.defects.rtc.WorkItemTransaction.addComments(WorkItemTransaction.java:166) at com.ibm.isvt.defects.service.RtcSummaryService.addComments(RtcSummaryService.java:127) at sun.reflect.GeneratedMethodAccessor471.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620)
One answer
Some operation has done an update to the work item. You need to resolve/fetch the work item again, short before you try to manipulate it. See https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/