It's all about the answers!

Ask a question

Unable to implement Rational Team Concert (RTC) plain jars to create work items via REST API calls from a WebSphere Server Application


Ruifeng Ma (112) | asked Dec 02 '15, 3:52 a.m.
edited Dec 16 '15, 5:09 a.m.
When trying to integrate RTC plain jars into a customized WebSphere server application, exception occurred at below code line.


this.teamRepository = TeamPlatform.getTeamRepositoryService().getTeamRepository(this.repositoryURI);


[12/2/15 16:04:19:883 SGT] 000000a4 BusinessExcep E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "createTestAutoDefect" on bean "BeanId(RTCWebClientEAR#RTCWebClient.war#RTCWorkItemHandler, null)". Exception data: java.lang.NoClassDefFoundError: com.ibm.team.repository.client.internal.ContributorManager (initialization failure) at java.lang.J9VMInternals.initialize(J9VMInternals.java:177) at com.ibm.team.repository.client.internal.TeamRepository.(TeamRepository.java:427) at com.ibm.team.repository.client.internal.TeamRepositoryService.createSharedTeamRepository(TeamRepositoryService.java:526) at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeamRepository(TeamRepositoryService.java:113) at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeamRepository(TeamRepositoryService.java:132)

...

Caused by: java.lang.IllegalArgumentException: The type name Contributor and the namespace URI com.ibm.team.repository do not resolve to an IItemType. at com.ibm.team.repository.common.internal.querypath.AbstractQueryPathModel$Implementation.getItemType(AbstractQueryPathModel.java:192) at com.ibm.team.repository.common.query.IQuery$Factory.newInstance(IQuery.java:93) at com.ibm.team.repository.client.internal.ContributorManager.createAllContributorsQuery(ContributorManager.java:72) at com.ibm.team.repository.client.internal.ContributorManager.(ContributorManager.java:60) at java.lang.J9VMInternals.initializeImpl(Native Method) at java.lang.J9VMInternals.initialize(J9VMInternals.java:237) at com.ibm.team.repository.client.internal.TeamRepository.(TeamRepository.java:427) at com.ibm.team.repository.client.internal.TeamRepositoryService.createSharedTeamRepository(TeamRepositoryService.java:526) at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeamRepository(TeamRepositoryService.java:113) at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeamRepository(TeamRepositoryService.java:132)


It seems classes in the RTC plain jars are not properly loaded.

Those jars were put into the library folder of the EAR that hosts the web project that implements RTC functions.


Comments
Ruifeng Ma commented Dec 16 '15, 7:11 a.m. | edited Dec 16 '15, 7:11 a.m.

Similar issue was also discussed in this RTC enhancement work item: 


3 answers



permanent link
Ruifeng Ma (112) | answered Dec 16 '15, 5:08 a.m.
edited Dec 16 '15, 5:08 a.m.
Resolved the issue by tweaking WebSphere's class loading behavior as below:

In the RAD (eclipase core) IDE, right Click on the EAR that contains the web project for RTC client -> Java EE -> Open WebSphere Application Server Deployment, go to Application section and make Classloader mode: PARENT_LAST and WAR classloader policy: APPLICATION

Found this solution via: https://jazz.net/forum/questions/75680/cant-connect-to-jazz-server-in-was-70?page=1&focusedAnswerId=75682#75682

The cause could most likely be because of missing plugin configurations in eclipse classes, resulting from class loading behavior.

WebSphere is implemented through OSGI technology like eclipse, hence the eclipse platform classes by default are loaded from WebSphere, not the RTC client libraries (plain RTC jar files) included in the EAR application.

Hence a possible solution would be to reverse the class loading policy.


permanent link
Kevin Ramer (4.5k6171189) | answered Dec 16 '15, 11:26 a.m.
There are several steps to adding classes to a websphere application. Some are within WebSphere, some within the deployment descriptor of the application itself.  This document does a pretty good job and if memory serves helped me add Plain Java client to a custom application for user access requests.

Comments
Ruifeng Ma commented Dec 30 '15, 4:17 a.m.

 Very detailed and well-documented article! Thanks for sharing. 


permanent link
Ruifeng Ma (112) | answered Jan 08 '16, 3:39 a.m.
 Another possible way is to add RTC-Clicent-plainJavaLib as a shared library referenced by the application through WAS Admin Console.

1. Package the RTC java client library as a server scoped shared library
2. Make the shared library an isolated shared library by checking the "Use an isolated class loader for this shared library" checkbox in the Integrated Solutions console
3. Associate the shared library with the application or module

Some useful reference links

Creating shared libraries: 
https://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/tcws_sharedlib_create.html?lang=en

Associating shared libraries with applications or modules: 
https://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/tcws_sharedlib_app.html

Your answer


Register or to post your answer.