Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Invalid Credentials error even when the credentials are valid

Hello Team,

We are running an application which creates WIs in RTC, but sometimes even though the login credentials added in the code are correct, we get an error message stating "Invalid credentials - CRJAZ0124E The user name or password is invalid." But application runs properly when we run it again without making any changes.

Please find below the code snippet for your kind reference.

public ITeamRepository login(final String username, final String password, String url)
throws TeamRepositoryException {
logger.info("Entered Login method");
IProgressMonitor monitor = new SysoutProgressMonitor();
logger.info("going to TeamPlatform.startup()");
TeamPlatform.startup();
logger.info("TeamPlatform.startup() has started");
ITeamRepository repository = TeamPlatform.getTeamRepositoryService().getTeamRepository(url);
logger.info("setting registerLoginHandler");
repository.registerLoginHandler(new ITeamRepository.ILoginHandler() {
public ILoginInfo challenge(ITeamRepository repository) {
logger.info("succesfully setting registerLoginHandler");
return new ILoginInfo() {
public String getUserId() {
logger.info("Username in RTCLogin class"+username);
return username;
}

public String getPassword() {
logger.info("Getting inside getPassword() "+password);
return password;

}
};
}
});
monitor.subTask("Contacting " + repository.getRepositoryURI() + "...");
repository.login(monitor);
monitor.subTask("Connection successfull!!");
return repository;
}

}

The builds shows that the code is entering a continuous loop at ILoginInfo challenge method.

Could you please help us in finding the root cause for this issue?

Please do let us know if you need any further information.

Thanks a lot in advance.

0 votes


Accepted answer

Permanent link

 https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation shows example code that has always worked for me.

It is unclear why the login should sometimes not work. Maybe there is some kind of connection issue from the EWM server to LDAP or the license server.

Divya _ selected this answer as the correct answer

1 vote

Comments

The important part here is:

ITeamRepository teamRepository= TeamPlatform.getTeamRepositoryService().getTeamRepository(repositoryURI);

teamRepository.registerLoginHandler(new LoginHandler(userId, password));
teamRepository.login(null);

You would also likely want to surround the login with a tray/catch for TeamRepositoryException, if you want to retry. The call itself tries three times.

One other thing I have seen is:

Do not package everything in one JAR. have your own JAR and keep the Plain Java Client Libraries and other JAR's you use in folders in the classpath.

1 vote

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 7,487
× 1,316

Question asked: Nov 21 '23, 4:42 a.m.

Question was seen: 1,031 times

Last updated: Nov 22 '23, 3:07 a.m.

Confirmation Cancel Confirm