Create workitem server side extension don't work after deploying to server
Hello all,
I'm trying to create server side extenion, that will create new workitem in other project area, when checkbox in workitem is checked, and create link between this two workitems:
if (!workItem.isNewItem()) { IWorkItemServer workItemServer = (IWorkItemServer)getService(IWorkItemServer.class); IRepositoryItemService itemService = getService(IRepositoryItemService.class); IProcessServerService processService = getService(IProcessServerService.class); IWorkItemCommon workItemCommon = getService(IWorkItemCommon.class); IAuditableCommon iac = save.getSaveOperationParameter().getAuditableCommon(); IWorkItem workItemCopy = (IWorkItem)((IWorkItem)workItemServer.getAuditableCommon().resolveAuditable(workItem, IWorkItem.FULL_PROFILE, monitor)).getWorkingCopy(); IWorkItem oldWorkItem = (IWorkItem)save.getOldState(); String isLLRelevantSet = getCustomFieldValue(workItemCopy, workItemCopy.getCustomAttributes(), "LLRelevant", itemService, workItemCommon, iac, monitor); String wasLLRelevantSet = getCustomFieldValue(oldWorkItem, oldWorkItem.getCustomAttributes(), "LLRelevant", itemService, workItemCommon, iac, monitor); if (wasLLRelevantSet.equalsIgnoreCase("false") && isLLRelevantSet.equalsIgnoreCase("true")) { IWorkItemReferences oldReferences = workItemServer.resolveWorkItemReferences(oldWorkItem, monitor); if (!oldReferences.hasReferences(ILinkTypeRegistry.INSTANCE.getLinkType("com.ibm.team.apt.linktype.llCandidate").getSourceEndPointDescriptor()))
{
IProjectArea projectAreall = (IProjectArea) processService.findProcessArea("Lessons%20Learned", null); if (projectAreall != null) { IWorkItemType llCandidateType = workItemServer.findWorkItemType(projectAreall, "llCandidate", monitor);
IWorkItem llCandidate = workItemServer.createWorkItem2(llCandidateType); llCandidate.setHTMLSummary(workItemCopy.getHTMLSummary()); workItemServer.saveWorkItem3(llCandidate, null, null, bypass); IWorkItemReferences targetReferences = workItemServer.resolveWorkItemReferences(llCandidate, monitor); IEndPointDescriptor tracksEndpoint = ILinkTypeRegistry.INSTANCE.getLinkType("com.ibm.team.apt.linktype.llCandidate").getTargetEndPointDescriptor(); IReference targetEndpoint = IReferenceFactory.INSTANCE.createReferenceToItem(workItemCopy);
targetReferences.add(tracksEndpoint, targetEndpoint); workItemServer.saveWorkItem3(workItemCopy, targetReferences, null, bypass); }
On development environment everything works fine, but after deploying to test server running RTC 6.0.2 on WAS 8.5.5, workitem is not created, and no exception is thrown. Where can be problem?
2 answers
I'm trying to create save workitem operation participant. It checks is checkbox set, and if link of type hasLLCandidate not exist for this workitem (this is custom 0...1 link type), creates llCandidate workitem in project "Lessons Learned".
Full error message in log is:
/ccm/service/com.ibm.team.workitem.common.internal.rest.IWorkItemRestService/workItem2] ERROR com.ibm.team.process.common - Link does not reference work item java.lang.IllegalArgumentException: Link does not reference work item at com.ibm.team.workitem.common.internal.model.WorkItemReferences.hasSelfAsSource(WorkItemReferences.java:470) at com.ibm.team.workitem.common.internal.model.WorkItemReferences.remoteUpdate(WorkItemReferences.java:285) at com.ibm.team.workitem.service.internal.WorkItemServer.saveWorkItems(WorkItemServer.java:212) at com.ibm.team.workitem.service.internal.WorkItemServer.saveWorkItem3(WorkItemServer.java:156) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at com.ibm.team.workitem.service.internal.ServiceAdapter.invoke(ServiceAdapter.java:75) at com.sun.proxy.$Proxy801.saveWorkItem3(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy804.saveWorkItem3(Unknown Source) at corp.bury.participant.Llcandidatecreator.run(Llcandidatecreator.java:146) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy1076.run(Unknown Source) at com.ibm.team.process.internal.common.advice.runtime.OperationAdviceManager.runParticipant(OperationAdviceManager.java:1156) at com.ibm.team.process.internal.common.advice.runtime.OperationAdviceManager.runParticipants(OperationAdviceManager.java:986) at com.ibm.team.process.internal.common.advice.runtime.OperationAdviceManager.advise(OperationAdviceManager.java:332) at com.ibm.team.process.internal.common.util.AbstractProcess.doAdvise(AbstractProcess.java:197) at com.ibm.team.process.internal.service.ServerProcess.access$2(ServerProcess.java:1) at com.ibm.team.process.internal.service.ServerProcess$2.run(ServerProcess.java:159) at com.ibm.team.repository.service.internal.PrimitiveTransactionService$3.run(PrimitiveTransactionService.java:169) at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runTransaction(RepositoryDatabase.java:386) at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runInTransaction(RepositoryDatabase.java:291) at com.ibm.team.repository.service.internal.PrimitiveTransactionService.runInTransaction(PrimitiveTransactionService.java:103) at com.ibm.team.repository.service.internal.PrimitiveTransactionService.runInTransaction(PrimitiveTransactionService.java:98) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy164.runInTransaction(Unknown Source) at com.ibm.team.repository.service.internal.TransactionService.runInTransaction(TransactionService.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy261.runInTransaction(Unknown Source) at com.ibm.team.process.internal.service.ProcessService.runInTransaction(ProcessService.java:4858) at com.ibm.team.process.internal.service.ProcessService.runInTransaction(ProcessService.java:4865) at com.ibm.team.process.internal.service.ServerProcess.adviseAndExecute(ServerProcess.java:156) at com.ibm.team.workitem.service.internal.AuditableServerProcess.adviseAndExecute(AuditableServerProcess.java:86) at com.ibm.team.workitem.service.internal.WorkItemRepositoryService.processSave(WorkItemRepositoryService.java:617) at com.ibm.team.workitem.service.internal.WorkItemRepositoryService.save(WorkItemRepositoryService.java:519) at com.ibm.team.workitem.service.internal.WorkItemRepositoryService.save(WorkItemRepositoryService.java:487) at com.ibm.team.workitem.service.internal.WorkItemRepositoryService.access$4(WorkItemRepositoryService.java:484) at com.ibm.team.workitem.service.internal.WorkItemRepositoryService$1.run(WorkItemRepositoryService.java:331) at com.ibm.team.workitem.service.internal.WorkItemRepositoryService$1.run(WorkItemRepositoryService.java:1) at com.ibm.team.repository.service.internal.PrimitiveTransactionService$3.run(PrimitiveTransactionService.java:169) at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$Transaction.run(RepositoryDatabase.java:570) at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$2.run(RepositoryDatabase.java:354) at com.ibm.team.repository.service.internal.rdb.ConnectionPoolService.withCurrentConnection(ConnectionPoolService.java:476) at sun.reflect.GeneratedMethodAccessor118.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy113.withCurrentConnection(Unknown Source) at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runTransaction(RepositoryDatabase.java:351) at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runInTransaction(RepositoryDatabase.java:291) at com.ibm.team.repository.service.internal.PrimitiveTransactionService.runInTransaction(PrimitiveTransactionService.java:103) at com.ibm.team.repository.service.internal.PrimitiveTransactionService.runInTransaction(PrimitiveTransactionService.java:98) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy164.runInTransaction(Unknown Source) at com.ibm.team.repository.service.AbstractService.runInTransaction(AbstractService.java:1007) at com.ibm.team.workitem.service.internal.WorkItemRepositoryService.saveTransaction(WorkItemRepositoryService.java:323) at com.ibm.team.workitem.service.internal.WorkItemRepositoryService.save(WorkItemRepositoryService.java:278) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy826.save(Unknown Source) at com.ibm.team.workitem.service.internal.WorkItemServer.save(WorkItemServer.java:565) at com.ibm.team.workitem.service.internal.WorkItemServer.saveWorkItems(WorkItemServer.java:187) at com.ibm.team.workitem.service.internal.rest.WorkItemRestService.postWorkItem2(WorkItemRestService.java:531) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy845.postWorkItem2(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at com.ibm.team.repository.servlet.AbstractTeamServerServlet.doModelledRestService(AbstractTeamServerServlet.java:575) at com.ibm.team.repository.servlet.AbstractTeamServerServlet.handleRequest2(AbstractTeamServerServlet.java:2524) at com.ibm.team.repository.servlet.AbstractTeamServerServlet.handleRequest(AbstractTeamServerServlet.java:2315) at com.ibm.team.repository.servlet.AbstractTeamServerServlet.service(AbstractTeamServerServlet.java:1794) at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180) at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61) at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:126) at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:76) at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) at org.eclipse.equinox.servletbridge.BridgeServlet.service(BridgeServlet.java:138) at com.ibm.team.repository.server.servletbridge.JazzServlet.service(JazzServlet.java:74) at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1233) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:782) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:481) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97) at com.ibm.team.repository.server.servletbridge.BridgeFilter.processDelegate(BridgeFilter.java:165) at com.ibm.team.repository.server.servletbridge.BridgeFilter.doFilter(BridgeFilter.java:198) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:191) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:967) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107) at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:949) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:88) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)
Interesting information would be
- Does the extension show up as configurable in the Eclipse Process Customization?
- Did you perform a server reset request?
- Does the new Jazz Component show up in the Component Status internal page?
- Did you deploy to CCM and NOT JTS?
- Any hint in the CCM log?
Comments
Hi Ralph,
- yes, I can choose this extension in Eclipse and in Web UI,
- yes, I performed server reset request,
- can you tell me more, where I can find Component Status page?
- yes, plugin is deployed on CCM,
- in CCM log I get only the same information as in UI - Link does not reference work item (when trying to run second saveWorkitem action with links between workitems).
yes, I can choose this extension in Eclipse and in Web UI,
can you tell me more, where I can find Component Status page?
in CCM log I get only the same information as in UI - Link does not reference work item (when trying to run second saveWorkitem action with links between workitems).
The error you show below seems to indicate that the work item the link points to does not exist. You don't check if the save operation for the new work item succeeds.
Link type is my custom linktype, created in the way described here:
https://rsjazz.wordpress.com/2014/12/03/creating-custom-link-types-for-rational-team-concert/
Workitem type llCandidate requires only summary and description to be set, and all permissions are set properly.
I've made changes and added condidtion:
IWorkItemType llCandidateType = workItemServer.findWorkItemType(projectAreall, "llCandidate", monitor); IWorkItem llCandidate = workItemServer.createWorkItem2(llCandidateType); llCandidate.setHTMLSummary(workItemCopy.getHTMLSummary(); llCandidate.setHTMLDescription(workItemCopy.getHTMLDescription()); IStatus creationState = workItemServer.saveWorkItem3(llCandidate, null, null, bypass); if (creationState.isOK()) { .....//rest of code }
but this doesn't help.
I've tried to debug extension on server, and I found that creationState code has value OK and when I check properties of llCandidate id has set value.
You should not use an IBM namespace for a custom link type.
I think, the problem is not in creating links, but in creating and saving workitem. As I wrote, when debugging, I see that after saveworkitem id is set, but when I try to search for this workitem id, it can't be found.
I've changed the code to create workitem in the same projectArea as existig workitem, but no new workitem is created.
I think you don't really know that the problem is so far. My strategy would be to simplify the problem domain and focus until you understand parts are working.
Comments
Marcin Blacha
Jun 24 '17, 8:57 a.m.I'm sorry, but I can't edit my post to get code looking better - when trying to save I'm getting message that my post is spam.