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

Accessing RTC repository from java class invoked by BIRT report

Hello all.

We are trying to create a birt report that uses a java class as the data source.

Following the steps described in the article:

https://www.ibm.com/developerworks/community/blogs/JazzyTunes/entry/creating_birt_reports_for_rtc_which_invokes_java_code?lang=en

We were able to call the class successfully from the BIRT report.

The java class needs to access the RTC repository in order to fetch the data it needs for it's calculations.

When we try calling the getService method, we get an exception.

When Calling:

getService(IRepositoryItemService.class)

We receive:

com.ibm.team.repository.common.transport.internal.registry.ServiceNotFoundException: The service 'com.ibm.test.pkg.TestAPI@2cc92cc9' failed to find the

required service 'interface com.ibm.team.repository.service.IRepositoryItemService'. Check <prerequisites>

in plugin.xml.

When Calling:

getService(IProcessServerService.class)

We receive:

com.ibm.team.repository.common.transport.internal.registry.ServiceNotFoundException: The service 'com.ibm.test.pkg.TestAPI@2cc92cc9' failed to find the
required service 'interface com.ibm.team.process.service.IProcessServerService'. Check <prerequisites> in plugin.xml.

The services are defined in the <prerequisites> of the fragment.xml

We also tried calling these services from a WorkItem Operation Advisor -

and in that case - everything worked just fine, and we were able to get the needed data from RTC.

So - the question is -

What should we do in order to access RTC services from a java class called from a BIRT report.

Many thanks in advance.

Shay

0 votes



One answer

Permanent link
getService() can only be called from code in a method of an existing service that has a dependency on that service declared in the plugin.xml. There is probably a non API way to do this. But I really do not want it exposed in a public forum.

0 votes

Comments

Hi Rafik.

Thanks a lot for the quick reply.

We found out that only the first instance of the class, an instance created when the server first starts up, has the ability to access the services.

And when we call

new pkg.ClassName();

from the report, the services are not available.

So we now hold a reference to the first instance, and rely on it to access the services for the instances required by the report.

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
× 457
× 324
× 89
× 11

Question asked: May 28 '15, 5:19 a.m.

Question was seen: 3,738 times

Last updated: May 31 '15, 8:00 a.m.

Confirmation Cancel Confirm