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);
Exception:
[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.<init>(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.<clinit>(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.<init>(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.
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.