Jazz client API java.lang.NullPointerException
Hi Everyone,
I'm using the plain Java client code (link below) to be able to create a work item pragmatically. https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation It works successfully but I'm getting the following java.lang.NullPointerException in the output and it's related to the following line of code : ITeamRepository teamRepository= TeamPlatform.getTeamRepositoryService().getTeamRepository(repositoryURI); I'm using RTC v3.0.1.1 and download the corresponding RTC Client API JARs . Here are my questions :- (1) Any idea what might be causing this ? (2) I'm planning to be able to create,edit, and close work items problematically. Is this the Jazz client API enough or shall I investigate on a REST API alternative ? Thanks, Output: ====== java.lang.NullPointerException at com.ibm.team.repository.common.internal.util.VersionStringComparator.getIntegerParts(VersionStringComparator.java:71) at com.ibm.team.repository.common.internal.util.VersionStringComparator.innerCompare(VersionStringComparator.java:45) at com.ibm.team.repository.common.internal.util.VersionStringComparator.compare(VersionStringComparator.java:32) at com.ibm.team.repository.common.internal.util.ModelElementDescriptor$EvolutionDescriptorComponentVersionComparator.compare(ModelElementDescriptor.java:152) at com.ibm.team.repository.common.internal.util.ModelElementDescriptor$EvolutionDescriptorComponentVersionComparator.compare(ModelElementDescriptor.java:1) at java.util.TreeMap.compare(Unknown Source) at java.util.TreeMap.put(Unknown Source) at java.util.TreeSet.add(Unknown Source) at com.ibm.team.repository.common.internal.util.ModelElementDescriptor.processEvolutionElement(ModelElementDescriptor.java:60) at com.ibm.team.repository.common.internal.util.ModelElementDescriptor.processChild(ModelElementDescriptor.java:53) at com.ibm.team.repository.common.transport.AbstractElementDescriptor.processChildren(AbstractElementDescriptor.java:725) at com.ibm.team.repository.common.transport.AbstractElementDescriptor.<init>(AbstractElementDescriptor.java:60) at com.ibm.team.repository.common.internal.util.AbstractComponentChildElementDescriptor.<init>(AbstractComponentChildElementDescriptor.java:30) at com.ibm.team.repository.common.internal.util.ModelElementDescriptor.<init>(ModelElementDescriptor.java:37) at com.ibm.team.repository.common.internal.util.ComponentElementDescriptor.processChild(ComponentElementDescriptor.java:262) at com.ibm.team.repository.common.transport.AbstractElementDescriptor.processChildren(AbstractElementDescriptor.java:725) at com.ibm.team.repository.common.transport.AbstractElementDescriptor.<init>(AbstractElementDescriptor.java:60) at com.ibm.team.repository.common.internal.util.ComponentElementDescriptor.<init>(ComponentElementDescriptor.java:39) at com.ibm.team.repository.common.internal.util.ComponentRegistry.handleExtensionAdded(ComponentRegistry.java:860) at com.ibm.team.repository.common.internal.util.ComponentRegistry.handleExtensionAdded(ComponentRegistry.java:1) at com.ibm.team.repository.common.util.ExtensionRegistryReader.basicHandleExtensionAdded(ExtensionRegistryReader.java:205) at com.ibm.team.repository.common.util.ExtensionRegistryReader.handleExtensionAddedToRegistry(ExtensionRegistryReader.java:624) at com.ibm.team.repository.common.util.ExtensionRegistryReader.addContributedExtensions(ExtensionRegistryReader.java:143) at com.ibm.team.repository.common.util.ExtensionRegistryReader.start(ExtensionRegistryReader.java:1129) at com.ibm.team.repository.common.util.ExtensionRegistryReader.earlyStart(ExtensionRegistryReader.java:318) at com.ibm.team.repository.common.util.ExtensionRegistryReader.<init>(ExtensionRegistryReader.java:114) at com.ibm.team.repository.common.internal.util.ComponentRegistry.<init>(ComponentRegistry.java:75) at com.ibm.team.repository.common.internal.util.ComponentRegistry.<clinit>(ComponentRegistry.java:47) at com.ibm.team.repository.common.LogFactory.getLog(LogFactory.java:71) at com.ibm.team.repository.client.internal.TeamRepositoryService.<clinit>(TeamRepositoryService.java:70) at com.ibm.team.repository.client.TeamPlatform.getTeamRepositoryService(TeamPlatform.java:126) at com.ibm.team.workitem.ide.ui.example.CreateWorkItem.run(CreateWorkItem.java:131) at com.ibm.team.workitem.ide.ui.example.CreateWorkItem.main(CreateWorkItem.java:101) Jul 31, 2013 8:42:52 AM com.ibm.team.repository.common.transport.AbstractElementDescriptor processChildren SEVERE: null java.lang.NullPointerException at com.ibm.team.repository.common.internal.util.VersionStringComparator.getIntegerParts(VersionStringComparator.java:71) at com.ibm.team.repository.common.internal.util.VersionStringComparator.innerCompare(VersionStringComparator.java:45) at com.ibm.team.repository.common.internal.util.VersionStringComparator.compare(VersionStringComparator.java:32) at com.ibm.team.repository.common.internal.util.ModelElementDescriptor$EvolutionDescriptorComponentVersionComparator.compare(ModelElementDescriptor.java:152) at com.ibm.team.repository.common.internal.util.ModelElementDescriptor$EvolutionDescriptorComponentVersionComparator.compare(ModelElementDescriptor.java:1) at java.util.TreeMap.compare(Unknown Source) at java.util.TreeMap.put(Unknown Source) at java.util.TreeSet.add(Unknown Source) at com.ibm.team.repository.common.internal.util.ModelElementDescriptor.processEvolutionElement(ModelElementDescriptor.java:60) at com.ibm.team.repository.common.internal.util.ModelElementDescriptor.processChild(ModelElementDescriptor.java:53) at com.ibm.team.repository.common.transport.AbstractElementDescriptor.processChildren(AbstractElementDescriptor.java:725) at com.ibm.team.repository.common.transport.AbstractElementDescriptor.<init>(AbstractElementDescriptor.java:60) at com.ibm.team.repository.common.internal.util.AbstractComponentChildElementDescriptor.<init>(AbstractComponentChildElementDescriptor.java:30) at com.ibm.team.repository.common.internal.util.ModelElementDescriptor.<init>(ModelElementDescriptor.java:37) at com.ibm.team.repository.common.internal.util.ComponentElementDescriptor.processChild(ComponentElementDescriptor.java:262) at com.ibm.team.repository.common.transport.AbstractElementDescriptor.processChildren(AbstractElementDescriptor.java:725) at com.ibm.team.repository.common.transport.AbstractElementDescriptor.<init>(AbstractElementDescriptor.java:60) at com.ibm.team.repository.common.internal.util.ComponentElementDescriptor.<init>(ComponentElementDescriptor.java:39) at com.ibm.team.repository.common.internal.util.ComponentRegistry.handleExtensionAdded(ComponentRegistry.java:860) at com.ibm.team.repository.common.internal.util.ComponentRegistry.handleExtensionAdded(ComponentRegistry.java:1) at com.ibm.team.repository.common.util.ExtensionRegistryReader.basicHandleExtensionAdded(ExtensionRegistryReader.java:205) at com.ibm.team.repository.common.util.ExtensionRegistryReader.handleExtensionAddedToRegistry(ExtensionRegistryReader.java:624) at com.ibm.team.repository.common.util.ExtensionRegistryReader.addContributedExtensions(ExtensionRegistryReader.java:143) at com.ibm.team.repository.common.util.ExtensionRegistryReader.start(ExtensionRegistryReader.java:1129) at com.ibm.team.repository.common.util.ExtensionRegistryReader.earlyStart(ExtensionRegistryReader.java:318) at com.ibm.team.repository.common.util.ExtensionRegistryReader.<init>(ExtensionRegistryReader.java:114) at com.ibm.team.repository.common.internal.util.ComponentRegistry.<init>(ComponentRegistry.java:75) at com.ibm.team.repository.common.internal.util.ComponentRegistry.<clinit>(ComponentRegistry.java:47) at com.ibm.team.repository.common.LogFactory.getLog(LogFactory.java:71) at com.ibm.team.repository.client.internal.TeamRepositoryService.<clinit>(TeamRepositoryService.java:70) at com.ibm.team.repository.client.TeamPlatform.getTeamRepositoryService(TeamPlatform.java:126) at com.ibm.team.workitem.ide.ui.example.CreateWorkItem.run(CreateWorkItem.java:131) at com.ibm.team.workitem.ide.ui.example.CreateWorkItem.main(CreateWorkItem.java:101) Created work item 200809. |
2 answers
Ralph Schoon (63.5k●3●36●46)
| answered Jul 31 '13, 10:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You should consider reading http://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ and you should probably debug your code or split your failing expression to find out what part is null.
My experience with null pointer exceptions: Null Pointer and Other Exceptions I get exceptions, the API is broken! My experience so far is, that it was usually my fault. I didn’t understand the API, failed to resolve another item or made wrong assumptions that led to exceptions. The best approach is to really look into all parameters you pass. Also check if the client libraries you intent to get using the getClientLibraries() really return. One example where you won’t get it that way is the is the IContributorManager, which you don’t get using this call, but using ITeamRepository.getContributorManager(). If you try to get the Client Library otherwise it will return null. You either use the REST API or the Java API. Today, I think the Java API allows to do more than the REST API and I find it easier to handle and debug. This is obviously a personal preference though. |
did you copy the code exactly?
this line should be called before the one that failed TeamPlatform.startup(); I use the same approach in many of my java clients and it works fine. Comments
Mostafa Radwan
commented Jul 31 '13, 11:46 a.m.
Ralph Schoon
commented Jul 31 '13, 11:48 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
No, you don't need to install the client. All the required classes should be in the Plain Java Client Library Jar's.
Mostafa Radwan
commented Jul 31 '13, 11:51 a.m.
Thanks Ralph for your prompt response.....I'll continue troubleshooting and let you know how it goes.
Ralph Schoon
commented Jul 31 '13, 11:56 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Mostafa,
Mostafa Radwan
commented Jul 31 '13, 12:14 p.m.
Many Thanks :)
|
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.