service failed to activate because a service that it depends on, "com.ibm.team.repository.client.ITeamRepositoryService", is not registered.
I'm working on a server side extension and when I try to get a TeamRepositoryService I get this error in runtime.
I'm working on a Jetty test environment and I get connected to the test server through a RTC client in localhost.
When I catch a workitemsave event and I try to get the repo I get this error.
/jazz/service/com.ibm.team.workitem.common.internal.IWorkItemRepositoryService] ERROR com.ibm.team.process.common - CRJAZ6011E The operation participant cannot be created because an exception occurred. For more information, see the exception.
com.ibm.team.repository.common.transport.TeamServiceRegistryException: CRJAZ2671E The "net.jazz.rtcext.workitem.extensions.service.BuildOnStateChangeParticipant" service failed to activate because a service that it depends on, "com.ibm.team.repository.client.ITeamRepositoryService", is not registered.
I tried in both the following ways
ITeamRepository repo = TeamPlatform.getTeamRepositoryService().getTeamRepository("http://localhost:7443/jazz");
ITeamRepositoryService repoService = this.getService(ITeamRepositoryService.class);
I added the requested service both in the manifest dependencies and plugin.xml as prerequisites
Any idea of why I get this TeamServiceRegistryException?
3 answers
ITeamRepository is client API. You can't use it on the server. You can't gerService() interfaces that are no services.
public class MyPlugin extends AbstractService implements IOperationParticipant {
instead of
public class MyPlugin extends AbstractScmService implements IOperationAdvisor {
?
Can't I use IOperationParticipant?
Comments
I mean the opposite, sorry :)
Participants run after the save has been done. Advisors run upfront and can block saves.
What is the use case, what are you trying to do? If we don't have the slightest idea what the extension is supposed to do, we can't help.
The example I provided is special, as it works with the SCM part when delivering and shows special classes to access the SCM system - since you mentioned that above.
All I am saying so far is, that you can't use a client API in the server (at least not easily) . Also there are examples that might (or might not) be interesting to you.
Thanks Ralph, this AbstractScmService is showing me a new world actually.
I'm reading the methods, what i'm trying to do is to access a file in a changeset and modify it. So i was thinking that i need a workspace connection but also that one is in the client api. Have you any snippet of code or a suggestion of how I can do it?
I would think most of the methods used in the client API should be available. However, you have to use the server or the common API. The packages of the common api are usually named com.ibm.team.......common the server API is in packages com.ibm.team.......server. Both should be available in the server. Client API com.ibm.team.......client, is not. You can search on my blog for server API examples, but I don't think I have a lot of SCM code, especially for the server. Again, however, the server API, should have similar ways for most of the stuff.
Thanks again, i will take a look and let you know.
The actions the i'd like to do are
configuration.determineAncestorsInHistory(lst,getMon);
but to do this i need
IConfiguration configuration = workspaceConnection.configuration(component);
and to do this i need
IWorkspaceConnection workspaceConnection= workspaceManager.getWorkspaceConnection
but these methods are client side so I cannot use them.
So I cannot find a method to access files in the changeset.
I've found IScmService.configurationDetermineAncestorInHistory but it need a ServiceConfigurationProvider and i don't know where to obtain this object.
If anyone has suggestions or examples would be wonderful. It's strange that is possible (but not simple) to access files in the client side but quite difficult to do this on the server side.
Comments
sam detweiler
Sep 08 '14, 7:42 a.m.the teamrepositoryservice is a client side api only.
your server side extension is running IN the repository.
what do you want to do in workitemsave?
Marco Gianfico
Sep 08 '14, 8:22 a.m.I'm trying to access all the files included in a changeset.
So i need to access the workspace of the changeset.
sam detweiler
Sep 08 '14, 8:35 a.m.what info do you have? workitem for sure.. link to a changeset?
Marco Gianfico
Sep 08 '14, 8:52 a.m.Yes I have the changeset, iterating the changes I can get also the name of the files included in the changeset.
I also have the saveParameter, but nothing more interesting.