It's all about the answers!

Ask a question

Add Absences to users using Client APIs as web-service


0
2
Farhan Habib (156) | asked Jan 28 '16, 2:06 a.m.
  Hi All, 

I want to add absences to all users in RTC through Server APIs but these are not available So I have to use Client APIs for this task by following this link to run at back-end as service when file uploads through web-page: 
https://rsjazz.wordpress.com/2014/07/22/manage-scheduled-absences-using-the-plainjava-client-libraries/ 

For making Java Restful Webservice I convert this client extension which provided in the above link into Dynamic Web project and successfully created the service but then issue comes: 

Caused by: java.lang.ClassNotFoundException: com.ibm.team.apt.common.resource.IContributorAbsence 

Which i think the API of RTC SDK and that provided client extension will run without any issue if I run it as Java Applictation because target platform is RTC and it loads the APIs at runtime but not as a Service at compile time. 

Any Help is highly appreciated 

Accepted answer


permanent link
Ralph Schoon (63.1k33646) | answered Jan 28 '16, 2:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
The Plain Java Client Libraries are contained in a zip file you can download as described in the Extensions workshop.
You have to package these libraries (JAR files) with your application and add them to the ClassPath, so they can be loaded by the class loader.
Farhan Habib selected this answer as the correct answer

Comments
Farhan Habib commented Jan 28 '16, 2:40 a.m.

 Thanks Ralph for your quick response

Actually issue is not with the Plain Java Libraries, these loads fine but this exception:
Caused by: java.lang.ClassNotFoundException: com.ibm.team.apt.common.resource.IContributorAbsence

related to some API which exists in RTC sdk, not in Plain Java Libraries.
How can I load RTC Sdk at compile time while running web-service



Ralph Schoon commented Jan 28 '16, 3:00 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Since there is no public API for planning and the interface is packaged with the agile planning component (.apt.) the jar file is not shipped with the plain Java Client libraries and you have to search the file com.ibm.team.apt.common*.jar in the Eclipse Plugins folder. If you use Installation manager to install RTC Eclipse, it might be in the installation manager shared folder.


Ralph Schoon commented Jan 28 '16, 3:00 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You basically add that jar file to the other jar files you are using.


Farhan Habib commented Jan 28 '16, 3:14 a.m. | edited Jan 28 '16, 3:14 a.m.

 Thanks Ralph for your guidence, feeling honored while discussing with you

I just found the jars in Plug-in dependencies folder, So now I move forward to add those in class path as well
I will put the solution here If I able to complete my task


Ralph Schoon commented Jan 28 '16, 3:31 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Thanks for finding this, I updated the blog post.


Farhan Habib commented Jan 28 '16, 7:59 a.m.

 Task completed

These two jars were available in Plug-in dependencies:
- com.ibm.team.apt.client_3.0.1100.v20141011_0139.jar
- com.ibm.team.apt.common_3.0.1200.v20141011_0139.jar

which needs to be added in classpath


Ralph Schoon commented Jan 28 '16, 8:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You needed both? Thanks for letting us know.


Farhan Habib commented Jan 28 '16, 8:22 a.m.

Yes because these are the packages that were used in ScheduleAbsence Client Extension as you know:

com.ibm.team.apt.common.resource.IContributorAbsence;
com.ibm.team.apt.common.resource.IContributorAbsenceHandle;
com.ibm.team.apt.internal.client.resource.IContributorInfo;
com.ibm.team.apt.internal.client.resource.IResourcePlanningClient;
com.ibm.team.apt.internal.common.resource.model.ContributorAbsence;
com.ibm.team.apt.internal.common.util.ItemCollection;

and these needed both jars


Ralph Schoon commented Jan 28 '16, 8:46 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Good to know. Thank you very much!

I added that to the blog post as well.

I ran the tool from within Eclipse. These days I often also run it from outside, where it becomes apparent. Back then, I did not really have the time and also hadn't developed a good way for a standardized command line batch.

showing 5 of 9 show 4 more comments

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.