It's all about the answers!

Ask a question

service failed to activate because a service that it depends on, "com.ibm.team.repository.client.ITeamRepositoryService", is not registered.


Marco Gianfico (2049) | asked Sep 08 '14, 5:46 a.m.
I just cannot figure out why I have this problem.

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?



Comments
sam detweiler commented 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 commented 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 commented Sep 08 '14, 8:35 a.m.

what info do you have?  workitem for sure.. link to a changeset?


Marco Gianfico commented Sep 08 '14, 8:47 a.m. | edited 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.

3 answers



permanent link
Ralph Schoon (63.1k33645) | answered Sep 08 '14, 11:24 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Sep 08 '14, 11:26 a.m.
This is an advisor for SCM operations. It might be a good starting point: https://rsjazz.wordpress.com/2012/11/01/restrict-delivery-of-changesets-to-workitem-types-advisordelivery-of-changesets-associated-to-wrong-work-item-types-advisor/


ITeamRepository is client API. You can't use it on the server. You can't gerService() interfaces that are no services.

permanent link
Marco Gianfico (2049) | answered Sep 08 '14, 11:35 a.m.
So do you think that I have to use

public class MyPlugin extends AbstractService implements IOperationParticipant {

instead of

public class MyPlugin extends AbstractScmService implements  IOperationAdvisor {

?

Can't I use IOperationParticipant?

Comments
Marco Gianfico commented Sep 08 '14, 11:35 a.m.

I mean the opposite, sorry :)


Ralph Schoon commented Sep 08 '14, 11:51 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.


Marco Gianfico commented Sep 08 '14, 11:55 a.m.

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?


Ralph Schoon commented Sep 08 '14, 12:16 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.


Marco Gianfico commented Sep 08 '14, 12:32 p.m.

Thanks again, i will take a look and let you know.


permanent link
Marco Gianfico (2049) | answered Sep 09 '14, 6:14 a.m.
I'm sorry but i'm not able to find a solution to the problem.
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.


Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.