Connect to Jazz repository from eclipse plugin
Any insights are very much appreciate here.
I use the following code to connect to the Jazz repository:
if( TeamPlatform.isStarted() == false )
TeamPlatform.startup();
if( TeamPlatform.isStarted())
{
ITeamRepositoryService svc = TeamPlatform.getTeamRepositoryService();
repo = svc.getTeamRepository(repositoryURL);
repo.registerLoginHandler(new LoginHandler(userId, password));
repo.login(monitor);
}
} catch (Throwable e) {
// TODO Auto-generated catch block
e.printStackTrace();
repo = null;
TeamPlatform.shutdown();
return false;
}
This works well in my standalone java program. But when using the same code in RPT(Rational Performance Tester,the eclipse based plugin program our team are working on.) An exception throws at
repo = svc.getTeamRepository(repositoryURL);
The stack trace looks like the following:
java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.initialize(J9VMInternals.java:222)
at com.ibm.team.repository.client.internal.TeamRepository.<init>(TeamRepository.java:412)
at com.ibm.team.repository.client.internal.TeamRepositoryService.createSharedTeamRepository(TeamRepositoryService.java:366)
at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeamRepository(TeamRepositoryService.java:91)
at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeamRepository(TeamRepositoryService.java:110)
at com.ibm.rational.test.lt.comparison.analyzer.TeamRepository.loginToJazz(TeamRepository.java:58)
at com.ibm.rational.test.lt.comparison.analyzer.ui.LoginDialog.okPressed(LoginDialog.java:92)
.............
.............
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
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:190)
at com.ibm.team.repository.common.query.IQuery$Factory.newInstance(IQuery.java:92)
at com.ibm.team.repository.client.internal.ContributorManager.createAllContributorsQuery(ContributorManager.java:57)
at com.ibm.team.repository.client.internal.ContributorManager.<clinit>(ContributorManager.java:45)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
... 47 more
I use the following code to connect to the Jazz repository:
if( TeamPlatform.isStarted() == false )
TeamPlatform.startup();
if( TeamPlatform.isStarted())
{
ITeamRepositoryService svc = TeamPlatform.getTeamRepositoryService();
repo = svc.getTeamRepository(repositoryURL);
repo.registerLoginHandler(new LoginHandler(userId, password));
repo.login(monitor);
}
} catch (Throwable e) {
// TODO Auto-generated catch block
e.printStackTrace();
repo = null;
TeamPlatform.shutdown();
return false;
}
This works well in my standalone java program. But when using the same code in RPT(Rational Performance Tester,the eclipse based plugin program our team are working on.) An exception throws at
repo = svc.getTeamRepository(repositoryURL);
The stack trace looks like the following:
java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.initialize(J9VMInternals.java:222)
at com.ibm.team.repository.client.internal.TeamRepository.<init>(TeamRepository.java:412)
at com.ibm.team.repository.client.internal.TeamRepositoryService.createSharedTeamRepository(TeamRepositoryService.java:366)
at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeamRepository(TeamRepositoryService.java:91)
at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeamRepository(TeamRepositoryService.java:110)
at com.ibm.rational.test.lt.comparison.analyzer.TeamRepository.loginToJazz(TeamRepository.java:58)
at com.ibm.rational.test.lt.comparison.analyzer.ui.LoginDialog.okPressed(LoginDialog.java:92)
.............
.............
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
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:190)
at com.ibm.team.repository.common.query.IQuery$Factory.newInstance(IQuery.java:92)
at com.ibm.team.repository.client.internal.ContributorManager.createAllContributorsQuery(ContributorManager.java:57)
at com.ibm.team.repository.client.internal.ContributorManager.<clinit>(ContributorManager.java:45)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
... 47 more
One answer
Hi Lina,
Which version of RTC are you developing against? 2.x or 3.0?
When running under the Eclipse runtime (which you are in RPT), TeamPlatform.isStarted() should already be true, and it should already have initialized the item type registry, but I've seen cases where this doesn't happen.
Try 'kicking' it by referring to an item type explicitly, e.g.
com.ibm.team.repository.common.IContributor.toString();
Which version of RTC are you developing against? 2.x or 3.0?
When running under the Eclipse runtime (which you are in RPT), TeamPlatform.isStarted() should already be true, and it should already have initialized the item type registry, but I've seen cases where this doesn't happen.
Try 'kicking' it by referring to an item type explicitly, e.g.
com.ibm.team.repository.common.IContributor.toString();