It's all about the answers!

Ask a question

Invalid Credentials error even when the credentials are valid

Divya _ (254) | asked Nov 21 '23, 4:42 a.m.

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 {"Entered Login method");
IProgressMonitor monitor = new SysoutProgressMonitor();"going to TeamPlatform.startup()");
TeamPlatform.startup();"TeamPlatform.startup() has started");
ITeamRepository repository = TeamPlatform.getTeamRepositoryService().getTeamRepository(url);"setting registerLoginHandler");
repository.registerLoginHandler(new ITeamRepository.ILoginHandler() {
public ILoginInfo challenge(ITeamRepository repository) {"succesfully setting registerLoginHandler");
return new ILoginInfo() {
public String getUserId() {"Username in RTCLogin class"+username);
return username;

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

monitor.subTask("Contacting " + repository.getRepositoryURI() + "...");
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.

Accepted answer

permanent link
Ralph Schoon (63.1k33646) | answered Nov 21 '23, 11:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER 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

Ralph Schoon commented Nov 22 '23, 3:07 a.m.

The important part here is:

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

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

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.

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.