Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

RTC API - scmService, Operation adviser fails to instantiate.

Final Edit:
The problem was indeed in the xml tag, it should be, as Sam mentioned

            	<requiredService
            		interface="com.ibm.team.scm.common.IScmService"/>

				
				


notice the .common in contrast to .service

extending AbstractService then calling IScmService scmService = getService(IScmService.class);
or extending AbstractScmService then calling IScmService scmService = getScmService();
both approaches work given that the tag is included although the former seems to be the safer way to go (according to eclipse's warnings)

Problem:
I'm trying to create an OperationAdviser that uses this service

IScmService scmService = getService(IScmService.class);

What's the corresponding required service's interface's name that needs to go in the plugin.xml file? Where can I find a list of those services ?

at the moment I'm using
	               <requiredService  interface="com.ibm.team.scm.service.IScmService"/>
	
	
	
	
	
	
	
	
	
	


But that's causing the Operation Adviser to fail to instantiate with this error message

Problem
Unable to instantiate advisor operationAdvisor.
CRJAZ6010E The operation advisor cannot be created because an exception occurred.  For more information, see the exception.

This is the exception, it's extracted from the server log:
com.ibm.team.repository.common.transport.TeamServiceRegistryException: CRJAZ1094I The service "sesp.AbstractService" failed to be activated because a service it depends on, "com.ibm.team.scm.service.IScmService", has not been acquired and forcing service activation was not requested.

If I dont include that xml tag I get this:

Problem
An unhandled exception occurred during "send_email_server_plugin".

The service 'send_email_server_plugin.AbstractService@7d2b7d2b' failed to find the required service 'interface com.ibm.team.scm.common.IScmService'.  Check <prerequisites> in plugin.xml.



I also tried extending AbstractScmService instead of AbstractService and I get this exception instead (this is with the tag included)

2014-11-17 14:47:38,007 [http-bio-9443-exec-17 @@ 14:47 Z /ccm/service/com.ibm.team.scm.common.IScmService] ERROR t.internal.registry.AbstractActivationManagerOwner  - The class "com.ibm.team.scm.service.IScmService" failed to load. The bundle "sesp" could not find the class.




I've had a similar problem before but the exception wasn't thrown until the getService() function was executed. In other words the class had been instantiated successfully

EDIT: I also have com.ibm.team.scm.service as a plug-in dependency. Although I'm not sure if that's needed
 
INFO: RTC 4.0.7 with stock JDK/SDK/Plainjava
 

0 votes


Accepted answer

Permanent link
here is the xml for most of my scm participant

   <extension
         point="com.ibm.team.process.service.operationParticipants">
      <operationParticipant
            class="com.sd.tools.DeliverHook"
            id="com.sd.tools.deliver.hook.particpant"
            name="RTC SCM Deliver hook"
            operationId="com.ibm.team.scm.server.deliver">
            <extensionService
                componentId="com.sd.tools.deliver.hook.particpant.component"
                implementationClass="com.sd.tools.DeliverHook">
                <prerequisites>
                    <requiredService interface="com.ibm.team.repository.service.IRepositoryItemService"/>
                    <requiredService interface="com.ibm.team.repository.service.internal.IComponentMetadataProviderManagerService"/>
                    <requiredService interface="com.ibm.team.scm.common.IScmService"/>
                    <requiredService interface="com.ibm.team.process.service.IProcessServerService"/>
                    <requiredService interface="com.ibm.team.repository.service.IServerQueryService"/>
                    <requiredService interface="com.ibm.team.scm.common.internal.IScmQueryService"/>
                    <requiredService interface="com.ibm.team.repository.service.ITransactionService"/>
                    <requiredService interface="com.ibm.team.workitem.service.IAuditableServer"/>
                </prerequisites>              
             </extensionService>
             <description>
                fire hook script after deliver is completed
             </description>        
      </operationParticipant>

and my class definition
public class DeliverHook extends AbstractService implements IOperationParticipant
{
}
Zaid Al-Khishman selected this answer as the correct answer

2 votes

Comments

Hi Sam, that looks a lot like what I have here

            <prerequisites>                <requiredService                    interface="com.ibm.team.repository.service.IRepositoryItemService"/>               <!-- <requiredService                    interface="com.ibm.team.scm.service.IScmService"/> -->
I thought this looked interesting though:

https://jazz.net/forum/questions/102417/abstractscmadvisor-how-do-you-read-changed-file-content

particularly the comment right about the binding.

It may be a service that requires manual activation. The server I'm using has only been installed recently.




Moreover if we look at the provision status

https://<myremotehosthere>:<port>/ccm/admin?internal=true#action=com.ibm.team.repository.admin.provisionStatus

and try to ctrl-f
Starting the bundle "com.ibm.team.scm.service

I don't find anything. on the other hand
doing ctrl-f
Starting the bundle "com.ibm.team.repository.service

returns a match. I figure this may be the problem, except now I don't know how to force the server to start the service

I looked at this some more.. I think if you extend AbstractScmService, then the
api method getScmService(); will do the job and u don't need the prereq

on a blank line hit ctrl-spacebar to see all the methods available

Same error. I think it's probably because scm.service isn't running in the first place (unlike repository.service which seems to be very similar in concept and is working) how would I go about enabling it?

If there is a service start error, you should be able to see this on the diagnostics page. There should be a red cross.

https://rsjazz.wordpress.com/2012/11/01/restrict-delivery-of-changesets-to-workitem-types-advisordelivery-of-changesets-associated-to-wrong-work-item-types-advisor/ is an example for such an operation. Note, you extend the AbstractSCMService not AbstracService. You might also want to try Jetty first, if you don't to make sure everything works i a test environment.
The log files should also show errors if the services can be loaded.

Please be a ware that not all that looks like a service needs to be in the prerequisites. I have seen some that would cause trouble if you put them there. Best is to have a small list and only add that if the error message comes up that it is needed.

1 vote


One other answer

Permanent link
One thing that might help also, is to look at the source for one of the product provided plugins..

the one that seems most useful to me most times is the required content participant.

it is located in the com.ibm.team.filesystem.service plugin
eclipse plugins view, find by name, right click, import as source

package com.ibm.team.filesystem.service.internal.process
class RequiredContentAdvisor

there are a couple other plugins in this folder too..

1 vote

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,927

Question asked: Nov 17 '14, 2:53 p.m.

Question was seen: 4,722 times

Last updated: Nov 18 '14, 1:24 p.m.

Confirmation Cancel Confirm