I'm trying to trigger a job in Jenkins from java server. Jenkins is running on port 80 but when the Preemptive Auth is executing then creds are null because port returning as -1
if (authScheme != null) {
creds =
credsProvider.getCredentials(new AuthScope(
targetHost.getHostName(),
targetHost.getPort()));
if (creds == null) {
throw new HttpException("No credentials for preemptive authentication");
}
I saw this link on how to change the port that jenkins is using and also this link2 that explain that when not using a port (because of using https) it should be set to -1.
in the server there is a properties file that holds the Jenkins URL. after editing it to specific call port 80 (instead of just dropping it) then the trigger executed, but because of a mechanism that checking the job status (that it finish running) the next call is getting failed because the port is -1.
is there a way to see the port before changing? what else can I missed?