java.lang.NoClassDefFoundError: com/ibm/team/repository/client/ITeamRepository
Hello
Im trying to develop a follow-up for deliver action.
I need to get the component name of a changeset.
Im trying this
private ITeamRepository fRepository;
public followUpClassName(ITeamRepository repository) {
this.fRepository = repository;
}
Object data = operation.getOperationData(); ;
DeliverOperationData data1 = (DeliverOperationData) data;
List<IChangeSetHandle> changeSetHandles = data1.getChangeSetHandles();
List<IChangeSet> changeSets = fRepository.itemManager().fetchCompleteItems(changeSetHandles, IItemManager.DEFAULT, monitor1.newChild(25));
But when i run the deliver operation i get this error message: java.lang.NoClassDefFoundError: com/ibm/team/repository/client/ITeamRepository
Do you think i need any dependencie or external jar for get the change set??
Accepted answer
com/ibm/team/repository/client/ITeamRepository is part of the client API and not available in extensions run on the server. You must extend abstract service to get access to the service APIs.
See https://rsjazz.wordpress.com/2015/09/30/learning-to-fly-getting-started-with-the-rtc-java-apis/ for how to do this kind of stuff. Do the extensions workshop.
I think there is some SCM API in https://rsjazz.wordpress.com/2016/02/03/setting-access-control-permissions-for-scm-versionables/ and the related articles.There are other basic examples such as https://rsjazz.wordpress.com/2012/11/01/restrict-delivery-of-changesets-to-workitem-types-advisordelivery-of-changesets-associated-to-wrong-work-item-types-advisor/ you could look at.
One other answer
As the name suggests this exception in Java occurs when JVM tries to load a particular class and doesn't found the requested class in the classpath you specified. This means that, your classpath is broken. Java ClassNotFoundException thrown when an application tries to load in a class through its string name using:
- The forName method in class Class.
- The findSystemClass method in class ClassLoader .
- The loadClass method in class ClassLoader.
When you get a ClassNotFoundException , it means that the Java Virtual Machine has traversed the entire classpath you specified and not found the class you've attempted to reference. The one and only solution is to check your classpath carefully.
Verify the name of the requested class is correct and the specified .jar file exists in your classpath. If not, you must explicitly add it to your application’s classpath.
If it's present in your classpath then there is high chance that your classpath is getting overridden or application is using classpath specified in jar file or start-up script and to fix that you need to find the exact classpath used by your application.