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

Exception in the plain java client when run from commandline

I have implemented a plain java client which uses REST API.
It works fine when it is run inside of RTC, right clicking the class and using 'Run as Java Application' command. But when i export the project as runnable jar and invoke it from the command line of Windows, it throws the following error:

C:\Documents and Settings\u058592\Desktop\rtc>java -jar workitemvalidator.jar
started...
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.ibm.team.repository.client.internal.TeamRepository.<init>(TeamRep
ository.java:387)
at com.ibm.team.repository.client.internal.TeamRepositoryService.createS
haredTeamRepository(TeamRepositoryService.java:366)
at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeam
Repository(TeamRepositoryService.java:91)
at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeam
Repository(TeamRepositoryService.java:110)
at snippets.WorkItemValidator.login(WorkItemValidator.java:70)
at snippets.WorkItemValidator.main(WorkItemValidator.java:52)
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.AbstractQueryPathMo
del$Implementation.getItemType(AbstractQueryPathModel.java:190)
at com.ibm.team.repository.common.query.IQuery$Factory.newInstance(IQuer
y.java:92)
at com.ibm.team.repository.client.internal.ContributorManager.createAllC
ontributorsQuery(ContributorManager.java:57)
at com.ibm.team.repository.client.internal.ContributorManager.<clinit>(C
ontributorManager.java:45)
... 6 more


I don't see the difference between running via Eclipse or Command Line that can cause such an exception. Anyone have an idea?

Thanks in advance.

0 votes



4 answers

Permanent link
I got exactly the same problem. Does anyone know a solution for this problem ?

I tried :
com.ibm.team.repository.common.IItemType.IRegistry.INSTANCE.getAllItemTypes()

In RTC, I get 68 types. But, when I execute the jar, I get 0 types. That explain why Contributor does not resolve an IItemType.

The question is : why didn't I found the types ?

0 votes


Permanent link
Are you running:

import com.ibm.team.repository.client.TeamPlatform;
...
if (!TeamPlatform.isStarted()) {
TeamPlatform.startup();
}


This needs to be done as early as possible in your program, ideally in a static initializer to ensure all threads see the changes it makes. It initializes the EMF package and item type registries, among other things.

0 votes


Permanent link
The TeamPlatform.startup call has been done in the programm before getting the Item types.

http://jazz.net/forums/viewtopic.php?t=9722&highlight=contributor

Running with -Djava.ext.dirs option solved this problem.

0 votes


Permanent link
Interesting. Perhaps the class path was missing one of the required jars before.

0 votes

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
× 10,950

Question asked: Jul 29 '10, 12:13 p.m.

Question was seen: 6,230 times

Last updated: Jul 29 '10, 12:13 p.m.

Confirmation Cancel Confirm