IContributor from IContributorHandle
IContributorHandle owner = workItem.getOwner();
IRepositoryItemService itemService = getService(IRepositoryItemService.class);
IContributor user = (IContributor) itemService.fetchItem(owner, null);
I don't see any compilation errors in the project.
However, when the advisor runs, I get the following error:
Problem
An unhandled exception occurred during "Check Owner Advisor".
The service 'com.pb.CheckOwnerAdvisor@35f835f8' failed to find the required service 'interface com.ibm.team.repository.service.IRepositoryItemService'. Check <prerequisites> in plugin.xml.
I would deeply appreciate feedback on the issue.
Thanks.
Accepted answer
You'll need to be sure you have
<prerequisites>
<requiredService interface="com.ibm.team.repository.service.IRepositoryItemService"/>
.
.
</prerequisites>
Comments
Susan,
When I add prerequisites, I am getting a warning that prerequisites is not legal as a child of element extensionService. Is this warning normal?
<extensionService
componentId="rtc-check-owner-advisor.extensionService"
implementationClass="com.pb.CheckOwnerAdvisor">
<prerequisites>
<requiredserviceinterface="com.ibm.team.repository.service.IRepositoryItemService"/>
</prerequisites>
</extensionService>
yea, i get that warning
3 other answers
You must have an entry here for com.ibm.team.repository.service.
If you dont find it, please revisit your Target Platform to add the required library to it and add the dependency in the plugin configuration.
hope this helps.
Comments
I don't see the Prerequisite block in plugin.xml. I could try adding it to see if it makes a difference as was pointed out by previous comment.
However, here is the content of the manifest, which does show the Require bundle:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Rtc_check_owner_advisor
Bundle-SymbolicName: rtc_check_owner_advisor;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: com.ibm.team.process.common;bundle-version="1.2.0",
com.ibm.team.repository.common;bundle-version="1.1.0",
com.ibm.team.repository.service;bundle-version="1.1.0",
com.ibm.team.workitem.common;bundle-version="2.3.0"
Import-Package: org.eclipse.core.runtime;version="3.4.0"
the manifest content looks ok to me.. i have 403 setup with similar manifest file and the operation advisor thus created works well....
yes, though i dont see the <prerequisite> on my plugin.xml, you may still want to try the suggestion from Susan... let us know how it goes
you can get to it from the plugin.xml editor UI as well.. right click on the elements in the Extensions tab for additional items. (see image below)
<extension
point="com.ibm.team.process.service.operationParticipants">
<operationParticipant
class="com.sd.tools.CreateApprovalParticipant"
id="com.sd.tools.workitem.createapproval.participant"
name="Create Approval Participant"
operationId="com.ibm.team.workitem.operation.workItemSave">
<extensionService
componentId="com.sd.tools.workitem.createapproval.participant.component"
implementationClass="com.sd.tools.CreateApprovalParticipant">
<prerequisites>
<requiredService interface="com.ibm.team.repository.common.service.IContributorService"/>
<requiredService interface="com.ibm.team.workitem.common.IAuditableCommon"/>
<requiredService interface="com.ibm.team.process.service.IProcessServerService"/>
<requiredService interface="com.ibm.team.workitem.service.IWorkItemServer"/>
<requiredService interface="com.ibm.team.repository.common.service.IQueryService"/>
<requiredService interface="com.ibm.team.repository.service.IRepositoryItemService"/>
</prerequisites>
</extensionService>
<description>
some description here
</description>
</operationParticipant>
</extension>