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: 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 : 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. |
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. |
Interesting. Perhaps the class path was missing one of the required jars before.
|
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.