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.
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:
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)
namespace URI com.ibm.team.repository do not resolve to an IItemType.
at
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
I got exactly the same problem. Does anyone know a solution for this problem ?
I tried :
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 ?
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 ?
Are you running:
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.
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.
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.
http://jazz.net/forums/viewtopic.php?t=9722&highlight=contributor
Running with -Djava.ext.dirs option solved this problem.