It's all about the answers!

Ask a question

workItemClient.findWorkItemById throws error java.lang.NoClassDefFoundError: com/ibm/team/workitem/api/common/connectors/IDataConnector


Tiago Fernandez (5331519) | asked Aug 09 '13, 4:27 p.m.
retagged Aug 12 '13, 11:30 a.m. by Ralph Earle (25738)

Hello,

I am doing my first tries with the Java Plain API just looking for a WokItem a show it through Groovy script like my first test.

Part of my simple code is:

import org.eclipse.core.runtime.IProgressMonitor;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import com.ibm.team.filesystem.common.workitems.ILinkConstants;
import com.ibm.team.links.client.ILinkManager;
import com.ibm.team.links.common.IItemReference;
import com.ibm.team.links.common.ILink;
import com.ibm.team.links.common.ILinkCollection;
import com.ibm.team.repository.client.IItemManager;
import com.ibm.team.repository.client.ILoginHandler2;
import com.ibm.team.repository.client.ILoginInfo2;
import com.ibm.team.repository.client.ITeamRepository;
import com.ibm.team.repository.client.TeamPlatform;
import com.ibm.team.repository.client.login.UsernameAndPasswordLoginInfo;
import com.ibm.team.repository.common.TeamRepositoryException;
import com.ibm.team.scm.client.IWorkspaceManager;
import com.ibm.team.scm.common.IChange;
import com.ibm.team.scm.common.IChangeSet;
import com.ibm.team.scm.common.IChangeSetHandle;
import com.ibm.team.scm.common.IVersionable;
import com.ibm.team.scm.common.IVersionableHandle;
import com.ibm.team.workitem.client.IWorkItemClient;
import com.ibm.team.workitem.common.model.IWorkItem;

....

try {
 println "hello in Try"
 
 // Login to the repository using the provided credentials
 ITeamRepository repo = TeamPlatform.getTeamRepositoryService().getTeamRepository(repoUri);
 repo.registerLoginHandler(new ILoginHandler2() {
  @Override
  public ILoginInfo2 challenge(ITeamRepository arg0) {
   return new UsernameAndPasswordLoginInfo(userId, password);
  }
 });
 repo.login(new SysoutProgressMonitor());
 println "I've logged in successfuly"
 
 

 
 // Find the work item on the server
 def workItemClient = (IWorkItemClient)repo.getClientLibrary(IWorkItemClient.class);
 
 int workItemNumber = -1;
   
 try {
  workItemNumber = Integer.parseInt(wi);
 } catch (NumberFormatException e) {
  println("Invalid work item nubmer:" + wi);
  exit(1);
 }
   
 def workItem = workItemClient.findWorkItemById(workItemNumber, IWorkItem.FULL_PROFILE, new SysoutProgressMonitor());
 println("["+workItem.getId()+"] "+workItem.getHTMLSummary().getPlainText());
 

 repo.logout();
} finally {
 TeamPlatform.shutdown();
}

 

....

 

 

 

But I get the following error in my console:

 >groovy script.groovy


hello
hello in Try
I've logged in successfuly
Caught: java.lang.NoClassDefFoundError: com/ibm/team/workitem/api/common/connectors/IDataConnector
java.lang.NoClassDefFoundError: com/ibm/team/workitem/api/common/connectors/IDataConnector
        at script.run(script.groovy:67)
Caused by: java.lang.ClassNotFoundException: com.ibm.team.workitem.api.common.connectors.IDataConnector
        ... 1 more

 

 I have added API jars into my <user>/.groovy/lib

so I can import them into my script,

but there I cannot see a jar file named like in the error com.ibm.team.workitem.api.common.connectors.IDataConnector

The version I am is the 4.0.2 and jars are too,

How could I fix the error? Should I download the missing jar from somewhere? 

 

Thanks for the help.

Accepted answer


permanent link
sam detweiler (12.4k6172200) | answered Aug 12 '13, 8:29 a.m.
that jar file is in the sdk, plugins folder

com.ibm.team.workitem.api.common_3.1.300.v20130429_0038.jar
Tiago Fernandez selected this answer as the correct answer

Comments
Tiago Fernandez commented Aug 12 '13, 2:24 p.m.

Thank you,

I found the jar in the RTC eclipse plugins folder, then I added it in my import list and it worked.

Your answer


Register or to post your answer.