Login error while connecting through RTC API
Hi,
We are trying to make a connection to RTC using RTC API. Both the RTC server and RTC API is of same version 6.0.3. Below is the code we are using -
============================================================
package RTC_RFT;
import org.eclipse.core.runtime.IProgressMonitor;
import resources.RTC_RFT.Script1Helper;
import com.rational.test.ft.;
import com.rational.test.ft.object.interfaces.;
import com.rational.test.ft.object.interfaces.SAP.;
import com.rational.test.ft.object.interfaces.WPF.;
import com.rational.test.ft.object.interfaces.dojo.;
import com.rational.test.ft.object.interfaces.siebel.;
import com.rational.test.ft.object.interfaces.flex.;
import com.rational.test.ft.object.interfaces.generichtmlsubdomain.;
import com.rational.test.ft.script.;
import com.rational.test.ft.value.;
import com.rational.test.ft.vp.;
import com.ibm.rational.test.ft.object.interfaces.sapwebportal.;
import com.ibm.team.repository.client.ITeamRepository;
import com.ibm.team.repository.client.TeamPlatform;
import com.ibm.team.repository.client.ITeamRepository.ILoginHandler.ILoginInfo;
import com.ibm.team.repository.common.TeamRepositoryException;
/
Description : Functional Test Script
@author user1
*/
public class Script1 extends Script1Helper
{
private static String REPOSITORY_ADDRESS = System.getProperty("repositoryAddress", "https://rtcurl.com");
private static String USER_AND_PASSWORD = System.getProperty("userid", "password");
public static void testMain(Object[] args) {
TeamPlatform.startup();
try {
IProgressMonitor monitor = new SysoutProgressMonitor();
login(monitor);
} catch (TeamRepositoryException e) {
System.out.println("Unable to login: " + e.getMessage());
} finally {
TeamPlatform.shutdown();
}
}
public static ITeamRepository login(IProgressMonitor monitor) throws TeamRepositoryException {
ITeamRepository repository = TeamPlatform.getTeamRepositoryService().getTeamRepository(REPOSITORY_ADDRESS);
repository.registerLoginHandler(new ITeamRepository.ILoginHandler() {
public ILoginInfo challenge(ITeamRepository repository) {
return new ILoginInfo() {
public String getUserId() {
return USER_AND_PASSWORD;
}
public String getPassword() {
return USER_AND_PASSWORD;
}
};
}
});
monitor.subTask("Contacting " + repository.getRepositoryURI() + "...");
repository.login(monitor);
monitor.subTask("Connected");
return repository;
}
}
========================================================
We get the below error for the above code's execution -
==============================
Exception occurred during playback of script [RTC_RFT.Script1] [CRFCN0019E: RationalTestScriptException on line 44 of script RTC_RFT.Script1 - java.lang.ClassCastException: com.ibm.team.process.internal.rcp.ui.RepositoryCertificateHandler incompatible with com.ibm.team.repository.client.ICertificateHandler.].
==============================
Please find the full stack trace of the error -
=================================================================
--- Information 30-Jun-2017 05:41:38.727 AM Script start [RTC_RFT.Script1]
line_number = 1
script_iter_count = 0
script_name = RTC_RFT.Script1
script_id = RTC_RFT.Script1.java
Fail 30-Jun-2017 05:41:42.805 AM RTC_RFT.Script1.login had an unhandled exception.
exception_name = java.lang.ClassCastException
exception_message = com.ibm.team.process.internal.rcp.ui.RepositoryCertificateHandler incompatible with com.ibm.team.repository.client.ICertificateHandler
script_name = RTC_RFT.Script1
script_id = RTC_RFT.Script1.java
line_number = 44
exception_stack = at com.ibm.team.repository.client.internal.CertificateHandlerExtensionReader$Descriptor.getHandler(CertificateHandlerExtensionReader.java:148)
at com.ibm.team.repository.client.internal.CertificateHandlerExtensionReader.getHighestPriorityHandler(CertificateHandlerExtensionReader.java:103)
at com.ibm.team.repository.client.internal.TeamRepository.getCertificateHandler(TeamRepository.java:1972)
at com.ibm.team.repository.client.internal.TeamRepository.<init>(TeamRepository.java:381)
at com.ibm.team.repository.client.internal.TeamRepositoryService.createSharedTeamRepository(TeamRepositoryService.java:526)
at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeamRepository(TeamRepositoryService.java:113)
at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeamRepository(TeamRepositoryService.java:132)
at RTC_RFT.Script1.login(Script1.java:44)
at RTC_RFT.Script1.testMain(Script1.java:35)
at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
at org.eclipse.core.launcher.Main.main(Main.java:34)
Fail 30-Jun-2017 05:41:42.805 AM Script end [RTC_RFT.Script1]
script_name = RTC_RFT.Script1
script_id = RTC_RFT.Script1.java
=================================================================
Can someone please suggest what may be causing the error and what is the fix ? Thanks in advance.
Accepted answer
- Download the snippets that come with the RTC plain Java Client Library and make them work
- Read your error message and fix the wrong import so that you use
import com.ibm.team.repository.client.ITeamRepository.ILoginHandler; import com.ibm.team.repository.client.ITeamRepository.ILoginHandler.ILoginInfo;