It's all about the answers!

Ask a question

Why does it take 2 minutes to login to RTC using a plainJava login API?

Dave Sinclair (21179) | asked May 17 '13, 9:22 a.m.
I have written some plainJava utilities for updating work items etc and have used the code examples available in this forum but I find that when i run the utility for the first time it takes > 2 mins to perform the initial login.

The relevant code is:

  public class RTCclient {
    private static Logger logger = null;
    private ITeamRepository teamRepository = null;
    private String repositoryURI  = null;
    private String userId         = null;
    private String password       = null;
    private static  IWorkspaceManager wm;
    private static  IWorkspace workspace;
    private static  IWorkspaceConnection workspaceConnection;
    private static  IFileSystemWorkItemManager fileWorkItemmanager;
    private static  IWorkspaceConnection streamConnection;
    private static  List<IComponent> iComponents;
    private static  IFileContentManager contentManager;
    private static  IComponent myComponent;
    private static  String myStreamName = "unknown";   
    private static class LoginHandler implements ILoginHandler, ILoginInfo {
        private String fUserId;
        private String fPassword;
         * @param userId
         * @param password
        private LoginHandler(String userId, String password) {
            fUserId   = userId;
            fPassword = password;
        public String getUserId() {
            return fUserId;
        public String getPassword() {
            return fPassword;
         public ILoginInfo challenge(ITeamRepository repository) {
            return this;

     * @param repositoryURI
     * @param rtcUserid
     * @param rtcPassword
    public RTCclient( String repositoryURI,
                      String rtcUserid,
                      String rtcPassword
                      //String projectAreaName
                    ) {
        this.repositoryURI = repositoryURI;
        this.userId =  rtcUserid;
        this.password = rtcPassword;
   public ITeamRepository login() {       
        this.teamRepository= TeamPlatform.getTeamRepositoryService().getTeamRepository(repositoryURI);
        this.teamRepository.registerLoginHandler(new LoginHandler(userId, password));
        try {
        } catch (TeamRepositoryException e) {
        return this.teamRepository;

and my Java utility simply performs a:

rtcClient       = new RTCclient("", "", "mypassword");
teamRepository  = rtcClient.login();

The login() call takes 120 secs or more the first time I run the utility.  If I then run the utility a little latter the login() takes 1 sec or so.

I also get the following console messages, for both slow and fast logins:

17-May-2013 12:57:58 org.apache.commons.httpclient.HttpMethodDirector isAuthenticationNeeded
INFO: Authentication requested but doAuthentication is disabled

Since I'm presumably using code that many others have used successfully, is there some setting on the server that might be incorrect?   Does anyone have any idea what might be causing the login delay?

2 answers

permanent link
sam detweiler (12.5k6195201) | answered May 17 '13, 10:36 a.m.
My first time connects are in the 6 second range, across a remote VPN connection to our test server.

permanent link
Ralph Schoon (63.2k33646) | answered May 17 '13, 10:12 a.m.
Hi Dave, you can find the code I am usually using here and in several posts on the site. It takes some time to initialize the TeamPlatform and to log into the system. However, I have never seen it taking 2 minutes. For me it is rather in the area of 30 seconds. It appears to be the same time every time I start a client. I am not sure why it takes only 1 sec the next time around. It is only quicker, if the java code is not finished. In that case the TeamPlatform is still loaded and has all the data cached that is required.

Your answer

Register or to post 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.