It's all about the answers!

Ask a question

Exception in the plain java client when run from commandline


Caner Kaplıca (121) | asked Jul 29 '10, 12:13 p.m.
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.

4 answers



permanent link
Sylvain LEQUEUX (2132728) | answered Nov 17 '10, 7:52 a.m.
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 ?

permanent link
Nick Edgar (6.5k711) | answered Nov 17 '10, 8:53 a.m.
JAZZ DEVELOPER
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.

permanent link
Sylvain LEQUEUX (2132728) | answered Nov 18 '10, 3:51 a.m.
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.

permanent link
Nick Edgar (6.5k711) | answered Nov 22 '10, 9:36 a.m.
JAZZ DEVELOPER
Interesting. Perhaps the class path was missing one of the required jars before.

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.