Jenkins error: "ERROR: Unable to install JDK unless a valid username/password is provided."
Asked Answered
C

5

15

I have added a new agent to my Jenkins controller, the connection itself seemed to go successfully via ssh, however when I try to build on that server the Job tries to download Java on the slave(even though java is all-ready installed on that server) and I'm getting the following Error:

Downloading JDK from http://download.oracle.com/otn/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.tar.gz Your Oracle account doesn't appear valid. Please specify a valid username/password ERROR: Unable to install JDK unless a valid username/password is provided. Finished: FAILURE

This is the output of java -version

openjdk version "1.8.0_131" OpenJDK Runtime Environment (build 1.8.0_131-b12) OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)

what do I need to do here? reinstall java manually?

Catt answered 9/7, 2017 at 8:38 Comment(1)
http://<hostname>/descriptorByName/hudson.tools.JDKInstaller/enterCredentialEmileeemili
D
23

I was stuck with same error, banged my head for hours but no luck. But finally the answer was JDK configuration on the Jenkins controller.

Writing this answer as I couldn't find much on this over internet.

  • Go to Manage Jenkins -> Global tool configuration and check the configuration for JDK in JDK installation.

  • Uncheck the install automatically checkbox as this will be forcing JDK installations on every agent.

If you want this option enabled then you have to give oracle account credentials which to be used by the Jenkins to download the JDK.

If you already have java installed on your slaves then you would be better to uncheck the checkbox.

Delfeena answered 27/10, 2017 at 19:46 Comment(3)
Where do you supply oracle credentials for this? I see the "agree" checkbox, but nowhere to supply anything else.Undershot
can i change it to install openjdk instead?Baxy
I can't find this option in my Jenkins version (probably not the newest one).Ghana
E
17

You can set the default credentials for Oracle here:

 http://<hostname>/descriptorByName/hudson.tools.JDKInstaller/enterCredential

hostname being your Jenkins URL. Thanks

Emileeemili answered 9/2, 2018 at 12:55 Comment(1)
This is the best answerCarpic
S
4

Just set the JAVA_HOME in your Jenkins slave so it doesn't try to install another Java.

Slight answered 9/7, 2017 at 8:52 Comment(2)
That had no effect for me :( Java 8Ghana
I have added below lines to my .bashrc... export JAVA_HOME="/usr/lib/jvm/jre-1.8.0-openjdk" export PATH=$JAVA_HOME/bin:$PATH This saved my lot of timeMethedrine
G
4

Tool Locations

The above two answers didn't work for me. But this did: at the bottom of your node configuration page, set one of your tools to be your JDK:

enter image description here

In fact, I needed to do the same thing with Maven.

Ghana answered 7/11, 2018 at 0:40 Comment(0)
O
0

[I have the same problem with jdk][1] [1]: https://i.sstatic.net/cHlYx.png

Goto Manage jenkins-> tool-> jdk, uncheck automatic installation, go to command prompt if it is windows instance -> search for java path (command-> where java) if it is uduntu instance -> search for java path (command -> which java)

copy the path and paste it over there and give java version name for it as your reference, try building your jenkinsfile now.

Opus answered 27/3 at 5:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.