Re: Jenkins not able to launch the slave due to unrecognizable JAVA_HOME

2024-04-19 Thread 'Maciej Jaros' via Jenkins Users

Just do this on the agent:

 * Get JDK 17 from Adoptium
   
   (Linux x64 in my case).
 * Unpack to |/var/jenkins|.
 * Rename unpacked “jdk[version]” to “jdk”.
 * Check: |/var/jenkins/jdk/bin/java -version|

Jenkins agent will use |/var/jenkins/jdk/bin/java| over any other version.

Cheers,
Nux

Sai Bhargav Kottisa (2024-04-18 18:40):

Hi,

I have upgraded java on both the controller and agent machines to 
OpenJdk 17 and tried to launch again via ssh but still i am getting 
the same error


*Controller* machine(*/usr/lib/jvm/Openjdk_17.0.6.0/bin/java*
* drwxr-xr-x* 10 *root* *root* 131 Jan 13  2023 *Openjdk_17.0.6.0* )
*
*
*Agent* machine (*/etc/java/Openjdk_17.0.6.0/bin/java*
*drwxr-xr-x* 10 *root    root*      131 Jan 14  2023 *Openjdk_17.0.6.0*)

SSHLauncher{host='md1npdvlnx416.dev.corp.local', port=22, 
credentialsId='taf-jenkins', jvmOptions='', javaPath='', 
prefixStartSlaveCmd='', suffixStartSlaveCmd='', 
launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, 
sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy, 
tcpNoDelay=true, trackCredentials=true} [04/18/24 12:27:46] [SSH] 
Opening SSH connection to md1npdvlnx416.dev.corp.local:22. [04/18/24 
12:27:46] [SSH] WARNING: SSH Host Keys are not being verified. 
Man-in-the-middle attacks may be possible against this connection. 
[04/18/24 12:27:46] [SSH] Authentication successful. [04/18/24 
12:27:46] [SSH] The remote user's environment is: Checking Java 
version in the PATH Java is not in the PATH nor configured with the 
javaPath setting, Jenkins will try to guess where is Java, this guess 
will be removed in the future. :Launch agents via SSH [04/18/24 
12:27:46] [SSH] Checking java version of /var/lib/jenkins/jdk/bin/java 
Couldn't figure out the Java version of /var/lib/jenkins/jdk/bin/java 
[04/18/24 12:27:46] [SSH] Checking java version of java Couldn't 
figure out the Java version of java [04/18/24 12:27:46] [SSH] Checking 
java version of /usr/bin/java Couldn't figure out the Java version of 
/usr/bin/java [04/18/24 12:27:46] [SSH] Checking java version of 
/usr/java/default/bin/java Couldn't figure out the Java version of 
/usr/java/default/bin/java [04/18/24 12:27:46] [SSH] Checking java 
version of /usr/java/latest/bin/java Couldn't figure out the Java 
version of /usr/java/latest/bin/java [04/18/24 12:27:46] [SSH] 
Checking java version of /usr/local/bin/java Couldn't figure out the 
Java version of /usr/local/bin/java [04/18/24 12:27:46] [SSH] Checking 
java version of /usr/local/java/bin/java Couldn't figure out the Java 
version of /usr/local/java/bin/java java.io.IOException: Java not 
found on hudson.slaves.SlaveComputer@3242743c. Install Java 8 or Java 
11 on the Agent. at 
hudson.plugins.sshslaves.JavaVersionChecker.resolveJava(JavaVersionChecker.java:83) 
at 
hudson.plugins.sshslaves.SSHLauncher.lambda$launch$0(SSHLauncher.java:460) 
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) 
at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 
at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 
at java.base/java.lang.Thread.run(Thread.java:829) [04/18/24 12:27:46] 
Launch failed - cleaning up connection [04/18/24 12:27:46] [SSH] 
Connection closed.




--
You received this message because you are subscribed to the Google Groups "Jenkins 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/7fab73df-4486-1e10-a05a-5c846ac6a89c%40mol.com.pl.


Re: Jenkins not able to launch the slave due to unrecognizable JAVA_HOME

2024-04-18 Thread 'Dirk Heinrichs' via Jenkins Users
Am Donnerstag, dem 18.04.2024 um 09:40 -0700 schrieb Sai Bhargav Kottisa:

Agent machine (/etc/java/Openjdk_17.0.6.0/bin/java
 drwxr-xr-x 10 rootroot  131 Jan 14 
 2023Openjdk_17.0.6.0)

As already written by Mark, you should NOT install things into /etc. It's 
neither meant for storing binaries (this is Linux, not HPUX), nor is it on the 
PATH, thus it cannot be found. If you install it from distribution packages, it 
will be installed into the correct location, where it can then be found when 
you launch the agent.

Otherwise, provide the full path to it in the agent configuration.

HTH...

Dirk

--

Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenText ™ Discovery | Recommind
Phone: +49 2226 15966 18
Email: dhein...@opentext.com
Website: 
www.recommind.de
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan, 
Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error) please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. 
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten 
haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. 
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht 
gestattet.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/628b27f152f541cbcb4add2742a5cbe34fe7746b.camel%40opentext.com.


Re: Jenkins not able to launch the slave due to unrecognizable JAVA_HOME

2024-04-18 Thread Ivan Fernandez Calvo
[SSH] The remote user's environment is: Checking Java version in the PATH 
Java is not in the PATH nor configured with the javaPath setting,

What happens if you enter by SSH in the agent with the same user you use to 
connect the Jenkins controller and execute java?

>ssh my-jenkins-user@my-ssh-agent
>java

I will guess

>command not found


On Thursday, April 18, 2024 at 6:40:23 PM UTC+2 sai.bh...@gmail.com wrote:

> Hi,
>
> I have upgraded java on both the controller and agent machines to OpenJdk 
> 17 and tried to launch again via ssh but still i am getting the same error
>
> *Controller* machine(*/usr/lib/jvm/Openjdk_17.0.6.0/bin/java*
> * drwxr-xr-x* 10 *root* *root* 131 
> Jan 13  2023 *Openjdk_17.0.6.0* )
>
> *Agent* machine (*/etc/java/Openjdk_17.0.6.0/bin/java*
>  *drwxr-xr-x* 10 *rootroot* 
>  131 Jan 14  2023 *Openjdk_17.0.6.0*)
>
> SSHLauncher{host='md1npdvlnx416.dev.corp.local', port=22, 
> credentialsId='taf-jenkins', jvmOptions='', javaPath='', 
> prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=60, 
> maxNumRetries=10, retryWaitTime=15, 
> sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy,
>  
> tcpNoDelay=true, trackCredentials=true} [04/18/24 12:27:46] [SSH] Opening 
> SSH connection to md1npdvlnx416.dev.corp.local:22. [04/18/24 12:27:46] 
> [SSH] WARNING: SSH Host Keys are not being verified. Man-in-the-middle 
> attacks may be possible against this connection. [04/18/24 12:27:46] [SSH] 
> Authentication successful. [04/18/24 12:27:46] [SSH] The remote user's 
> environment is: Checking Java version in the PATH Java is not in the PATH 
> nor configured with the javaPath setting, Jenkins will try to guess where 
> is Java, this guess will be removed in the future. :Launch agents via SSH 
> [04/18/24 12:27:46] [SSH] Checking java version of 
> /var/lib/jenkins/jdk/bin/java Couldn't figure out the Java version of 
> /var/lib/jenkins/jdk/bin/java [04/18/24 12:27:46] [SSH] Checking java 
> version of java Couldn't figure out the Java version of java [04/18/24 
> 12:27:46] [SSH] Checking java version of /usr/bin/java Couldn't figure out 
> the Java version of /usr/bin/java [04/18/24 12:27:46] [SSH] Checking java 
> version of /usr/java/default/bin/java Couldn't figure out the Java version 
> of /usr/java/default/bin/java [04/18/24 12:27:46] [SSH] Checking java 
> version of /usr/java/latest/bin/java Couldn't figure out the Java version 
> of /usr/java/latest/bin/java [04/18/24 12:27:46] [SSH] Checking java 
> version of /usr/local/bin/java Couldn't figure out the Java version of 
> /usr/local/bin/java [04/18/24 12:27:46] [SSH] Checking java version of 
> /usr/local/java/bin/java Couldn't figure out the Java version of 
> /usr/local/java/bin/java java.io.IOException: Java not found on 
> hudson.slaves.SlaveComputer@3242743c. Install Java 8 or Java 11 on the 
> Agent. at 
> hudson.plugins.sshslaves.JavaVersionChecker.resolveJava(JavaVersionChecker.java:83)
>  
> at 
> hudson.plugins.sshslaves.SSHLauncher.lambda$launch$0(SSHLauncher.java:460) 
> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at 
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
>  
> at 
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
>  
> at java.base/java.lang.Thread.run(Thread.java:829) [04/18/24 12:27:46] 
> Launch failed - cleaning up connection [04/18/24 12:27:46] [SSH] Connection 
> closed.
>
>
>
>
> And also i have tried *Launch agent by connecting to controller option*
>
>
> *but i am getting below error*
> java -jar agent.jar -url http://mo1csgw2321:8080/ -secret  -name 
> "TAF-child" -workDir "/var/lib/jenkins"
> Apr 18, 2024 4:11:50 PM org.jenkinsci.remoting.engine.WorkDirManager 
> initializeWorkDir
> INFO: Using /var/lib/jenkins/remoting as a remoting work directory
> Apr 18, 2024 4:11:51 PM org.jenkinsci.remoting.engine.WorkDirManager 
> setupLogging
> INFO: Both error and output logs will be printed to 
> /var/lib/jenkins/remoting
> Apr 18, 2024 4:11:51 PM hudson.remoting.Launcher createEngine
> INFO: Setting up agent: TAF-child
> Apr 18, 2024 4:11:51 PM hudson.remoting.Engine startEngine
> INFO: Using Remoting version: 3206.vb_15dcf73f6a_9
> Apr 18, 2024 4:11:51 PM org.jenkinsci.remoting.engine.WorkDirManager 
> initializeWorkDir
> INFO: Using /var/lib/jenkins/remoting as a remoting work directory
> Apr 18, 2024 4:11:51 PM hudson.remoting.Launcher$CuiListener status
> INFO: Locating server among [http:// mo1csgw2321:8080/]
> Apr 18, 2024 4:11:51 PM hudson.remoting.Launcher$CuiListener status
> *INFO: Could not locate server among [ http:// mo1csgw2321:8080/  ]; 
> waiting 10 seconds before retry*
> *java.io.IOException: http:// mo1csgw2321:8080/tcpSlaveAgentListener/ is 
> invalid: 404 Not Found*
> at 
> 

Re: Jenkins not able to launch the slave due to unrecognizable JAVA_HOME

2024-04-18 Thread Sai Bhargav Kottisa
Hi,

I have upgraded java on both the controller and agent machines to OpenJdk 
17 and tried to launch again via ssh but still i am getting the same error

*Controller* machine(*/usr/lib/jvm/Openjdk_17.0.6.0/bin/java*
* drwxr-xr-x* 10 *root* *root* 131 Jan 
13  2023 *Openjdk_17.0.6.0* )

*Agent* machine (*/etc/java/Openjdk_17.0.6.0/bin/java*
 *drwxr-xr-x* 10 *rootroot* 
 131 Jan 14  2023 *Openjdk_17.0.6.0*)

SSHLauncher{host='md1npdvlnx416.dev.corp.local', port=22, 
credentialsId='taf-jenkins', jvmOptions='', javaPath='', 
prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=60, 
maxNumRetries=10, retryWaitTime=15, 
sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy,
 
tcpNoDelay=true, trackCredentials=true} [04/18/24 12:27:46] [SSH] Opening 
SSH connection to md1npdvlnx416.dev.corp.local:22. [04/18/24 12:27:46] 
[SSH] WARNING: SSH Host Keys are not being verified. Man-in-the-middle 
attacks may be possible against this connection. [04/18/24 12:27:46] [SSH] 
Authentication successful. [04/18/24 12:27:46] [SSH] The remote user's 
environment is: Checking Java version in the PATH Java is not in the PATH 
nor configured with the javaPath setting, Jenkins will try to guess where 
is Java, this guess will be removed in the future. :Launch agents via SSH 
[04/18/24 12:27:46] [SSH] Checking java version of 
/var/lib/jenkins/jdk/bin/java Couldn't figure out the Java version of 
/var/lib/jenkins/jdk/bin/java [04/18/24 12:27:46] [SSH] Checking java 
version of java Couldn't figure out the Java version of java [04/18/24 
12:27:46] [SSH] Checking java version of /usr/bin/java Couldn't figure out 
the Java version of /usr/bin/java [04/18/24 12:27:46] [SSH] Checking java 
version of /usr/java/default/bin/java Couldn't figure out the Java version 
of /usr/java/default/bin/java [04/18/24 12:27:46] [SSH] Checking java 
version of /usr/java/latest/bin/java Couldn't figure out the Java version 
of /usr/java/latest/bin/java [04/18/24 12:27:46] [SSH] Checking java 
version of /usr/local/bin/java Couldn't figure out the Java version of 
/usr/local/bin/java [04/18/24 12:27:46] [SSH] Checking java version of 
/usr/local/java/bin/java Couldn't figure out the Java version of 
/usr/local/java/bin/java java.io.IOException: Java not found on 
hudson.slaves.SlaveComputer@3242743c. Install Java 8 or Java 11 on the 
Agent. at 
hudson.plugins.sshslaves.JavaVersionChecker.resolveJava(JavaVersionChecker.java:83)
 
at 
hudson.plugins.sshslaves.SSHLauncher.lambda$launch$0(SSHLauncher.java:460) 
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
 
at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
 
at java.base/java.lang.Thread.run(Thread.java:829) [04/18/24 12:27:46] 
Launch failed - cleaning up connection [04/18/24 12:27:46] [SSH] Connection 
closed.




And also i have tried *Launch agent by connecting to controller option*


*but i am getting below error*
java -jar agent.jar -url http://mo1csgw2321:8080/ -secret  -name 
"TAF-child" -workDir "/var/lib/jenkins"
Apr 18, 2024 4:11:50 PM org.jenkinsci.remoting.engine.WorkDirManager 
initializeWorkDir
INFO: Using /var/lib/jenkins/remoting as a remoting work directory
Apr 18, 2024 4:11:51 PM org.jenkinsci.remoting.engine.WorkDirManager 
setupLogging
INFO: Both error and output logs will be printed to 
/var/lib/jenkins/remoting
Apr 18, 2024 4:11:51 PM hudson.remoting.Launcher createEngine
INFO: Setting up agent: TAF-child
Apr 18, 2024 4:11:51 PM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 3206.vb_15dcf73f6a_9
Apr 18, 2024 4:11:51 PM org.jenkinsci.remoting.engine.WorkDirManager 
initializeWorkDir
INFO: Using /var/lib/jenkins/remoting as a remoting work directory
Apr 18, 2024 4:11:51 PM hudson.remoting.Launcher$CuiListener status
INFO: Locating server among [http:// mo1csgw2321:8080/]
Apr 18, 2024 4:11:51 PM hudson.remoting.Launcher$CuiListener status
*INFO: Could not locate server among [ http:// mo1csgw2321:8080/  ]; 
waiting 10 seconds before retry*
*java.io.IOException: http:// mo1csgw2321:8080/tcpSlaveAgentListener/ is 
invalid: 404 Not Found*
at 
org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:222)
at hudson.remoting.Engine.innerRun(Engine.java:809)
at hudson.remoting.Engine.run(Engine.java:563)

On Monday, April 15, 2024 at 10:26:26 PM UTC+5:30 kuisat...@gmail.com wrote:

> >Jenkins not able to launch the slave due to unrecognizable JAVA_HOME
>
> Stop using Slave and use Agent as a name for the Build Agents attached to 
> the Jenkins Controller (no longer master)
>
> >so could anyone please help as it is urgent
>
> This is a User group, so NOTHING here is urgent. If someone can help, I 
> will do it, 

Re: Jenkins not able to launch the slave due to unrecognizable JAVA_HOME

2024-04-15 Thread Ivan Fernandez Calvo
>Jenkins not able to launch the slave due to unrecognizable JAVA_HOME

Stop using Slave and use Agent as a name for the Build Agents attached to 
the Jenkins Controller (no longer master)

>so could anyone please help as it is urgent

This is a User group, so NOTHING here is urgent. If someone can help, I 
will do it, but it is not mandatory, and NOBODY can request urgency here.

And now we can continue with your question. 

As Mark said Java 12 was never supported and is not a LTS. 
It is recommended that the Jenkins Controller and the Build Agent process 
be run in the same Java version to avoid compatibility issues.
As the message said, the plugin tried to find the `java` binary in the 
PATH, which was impossible, so it tried to use some hardcoded paths. The 
correct way is to configure your build agent to have a Java binary in the 
PATH. How to do it depends on your distribution and the shell you use for 
the user who connects through SSH. There is plenty of documentation about 
how to set up the environment of a system/user in Linux/Unix.

Tools location is not used to locate the Java version to run the build 
agent process, it is used on jobs, so no matter the configuration you put 
there is not used.



On Monday, April 15, 2024 at 4:30:20 PM UTC+2 Mark Waite wrote:

> On Monday, April 15, 2024 at 7:09:03 AM UTC-7 Sai wrote:
>
> Hi,
>
> I have the below machine config
>
> *(Master Jenkins)*
> OS RedHat Enterprise Linux 7.6
> openjdk version "11.0.22" 2024-01-16 LTS
> path: /usr/lib/jvm/java-11-openjdk-11.0.22.0.7-1.el7_9.x86_64/bin/java
>
>
> The Jenkins project stopped supporting RHEL 7 in Nov 2023.  RHEL 7.9 is 
> the most recent release of RHEL 7.  You're running RHEL 7.6, an outdated 
> version of an unsupported operating system.  It might work, but the Jenkins 
> project no longer tests or verifies that operating system 
>  
>
>
> * (Slave Jenkins)*
> RHEL VERSION=7.9 (Maipo)
> openjdk version "12.0.2" 2019-07-16
> path: /etc/java/jdk-12.0.2+10/bin/java
>
>
> Jenkins has never supported Java 12.  I don't recall anyone ever doing any 
> Jenkins testing or Jenkins development with Java 12.  Java 12 is also not 
> supported by the OpenJDK project.
>
> Jenkins currently supports Java 11, Java 17, and Java 21.  
>
> The installation location that you are listing for Java 12 is unexpected.  
> Applications (like Java) are not intended to be installed in the "/etc" 
> directory.  If you install Java 11 on the agent operating system using 
> either Eclipse Temurin packages or operating system packages, it will not 
> place Java in "/etc".
>
> Your options include:
>
>- Install Java 11 on the agent and plan for future operating system 
>upgrades to replace RHEL 7 with something that is supported
>- Continue attempts with Java 12 on the agent after assuring that Java 
>12 is actually installed.  You'll be running an unsupported, untested 
>Jenkins configuration with an unsupported Java version
>- Install Java 17 on the controller and on the agent  and plan for 
>future operating system upgrades to replace RHEL 7 with something that is 
>supported
>- Install Java  21 on the controller and on the agent  and plan for 
>future operating system upgrades to replace RHEL 7 with something that is 
>supported
>
>
> but still jenkins not recognizing JAVA path
>
> so could anyone please help as it is urgent
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/77c5824d-4885-41f8-8d7e-03951a001144n%40googlegroups.com.


Re: Jenkins not able to launch the slave due to unrecognizable JAVA_HOME

2024-04-15 Thread Mark Waite


On Monday, April 15, 2024 at 7:09:03 AM UTC-7 Sai wrote:

Hi,

I have the below machine config

*(Master Jenkins)*
OS RedHat Enterprise Linux 7.6
openjdk version "11.0.22" 2024-01-16 LTS
path: /usr/lib/jvm/java-11-openjdk-11.0.22.0.7-1.el7_9.x86_64/bin/java


The Jenkins project stopped supporting RHEL 7 in Nov 2023.  RHEL 7.9 is the 
most recent release of RHEL 7.  You're running RHEL 7.6, an outdated 
version of an unsupported operating system.  It might work, but the Jenkins 
project no longer tests or verifies that operating system 
 


* (Slave Jenkins)*
RHEL VERSION=7.9 (Maipo)
openjdk version "12.0.2" 2019-07-16
path: /etc/java/jdk-12.0.2+10/bin/java


Jenkins has never supported Java 12.  I don't recall anyone ever doing any 
Jenkins testing or Jenkins development with Java 12.  Java 12 is also not 
supported by the OpenJDK project.

Jenkins currently supports Java 11, Java 17, and Java 21.  

The installation location that you are listing for Java 12 is unexpected.  
Applications (like Java) are not intended to be installed in the "/etc" 
directory.  If you install Java 11 on the agent operating system using 
either Eclipse Temurin packages or operating system packages, it will not 
place Java in "/etc".

Your options include:

   - Install Java 11 on the agent and plan for future operating system 
   upgrades to replace RHEL 7 with something that is supported
   - Continue attempts with Java 12 on the agent after assuring that Java 
   12 is actually installed.  You'll be running an unsupported, untested 
   Jenkins configuration with an unsupported Java version
   - Install Java 17 on the controller and on the agent  and plan for 
   future operating system upgrades to replace RHEL 7 with something that is 
   supported
   - Install Java  21 on the controller and on the agent  and plan for 
   future operating system upgrades to replace RHEL 7 with something that is 
   supported


but still jenkins not recognizing JAVA path

so could anyone please help as it is urgent

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/1c69941b-9fcf-4eae-a7cf-00e3e305009bn%40googlegroups.com.


Jenkins not able to launch the slave due to unrecognizable JAVA_HOME

2024-04-15 Thread Sai Bhargav Kottisa
Hi,

I have the below machine config

*(Master Jenkins)*
OS RedHat Enterprise Linux 7.6
openjdk version "11.0.22" 2024-01-16 LTS
path: /usr/lib/jvm/java-11-openjdk-11.0.22.0.7-1.el7_9.x86_64/bin/java


* (Slave Jenkins)*
RHEL VERSION=7.9 (Maipo)
openjdk version "12.0.2" 2019-07-16
path: /etc/java/jdk-12.0.2+10/bin/java

 I am facing the below problem while trying to launch an ON premise Linux 
slave agent 
SSHLauncher{host='md1npdvlnx416', port=22, credentialsId='taf-jenkins', 
jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', 
launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, 
sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy,
 
tcpNoDelay=true, trackCredentials=true} [04/15/24 06:08:54] [SSH] Opening 
SSH connection to md1npdvlnx416:22. [04/15/24 06:08:54] [SSH] WARNING: SSH 
Host Keys are not being verified. Man-in-the-middle attacks may be possible 
against this connection. [04/15/24 06:08:54] [SSH] Authentication 
successful. [04/15/24 06:08:54] [SSH] The remote user's environment is: 
Checking Java version in the PATH Java is not in the PATH nor configured 
with the javaPath setting, Jenkins will try to guess where is Java, this 
guess will be removed in the future. :Launch agents via SSH [04/15/24 
06:08:54] [SSH] Checking java version of 
/var/lib/jenkins/jenkins-agent/jdk/bin/java Couldn't figure out the Java 
version of /var/lib/jenkins/jenkins-agent/jdk/bin/java [04/15/24 06:08:54] 
[SSH] Checking java version of /etc/java/jdk-12.0.2+10/bin/java/bin/java 
Couldn't figure out the Java version of 
/etc/java/jdk-12.0.2+10/bin/java/bin/java [04/15/24 06:08:54] [SSH] 
Checking java version of /etc/java/jdk-12.0.2+10/bin/java/bin/java Couldn't 
figure out the Java version of /etc/java/jdk-12.0.2+10/bin/java/bin/java 
[04/15/24 06:08:54] [SSH] Checking java version of java Couldn't figure out 
the Java version of java [04/15/24 06:08:54] [SSH] Checking java version of 
/usr/bin/java Couldn't figure out the Java version of /usr/bin/java 
[04/15/24 06:08:54] [SSH] Checking java version of 
/usr/java/default/bin/java Couldn't figure out the Java version of 
/usr/java/default/bin/java [04/15/24 06:08:54] [SSH] Checking java version 
of /usr/java/latest/bin/java Couldn't figure out the Java version of 
/usr/java/latest/bin/java [04/15/24 06:08:54] [SSH] Checking java version 
of /usr/local/bin/java Couldn't figure out the Java version of 
/usr/local/bin/java [04/15/24 06:08:54] [SSH] Checking java version of 
/usr/local/java/bin/java Couldn't figure out the Java version of 
/usr/local/java/bin/java java.io.IOException: Java not found on 
hudson.slaves.SlaveComputer Install Java 8 or Java 11 on the Agent. at 
hudson.plugins.sshslaves.JavaVersionChecker.resolveJava(JavaVersionChecker.java:83)
 
at 
hudson.plugins.sshslaves.SSHLauncher.lambda$launch$0(SSHLauncher.java:460) 
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
 
at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
 
at java.base/java.lang.Thread.run(Thread.java:829) [04/15/24 06:08:54] 
Launch failed - cleaning up connection [04/15/24 06:08:54] [SSH] Connection 
closed. 
SSHLauncher{host='md1npdvlnx416', port=22, credentialsId='taf-jenkins', 
jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', 
launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, 
sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy,
 
tcpNoDelay=true, trackCredentials=true} [04/15/24 06:11:13] [SSH] Opening 
SSH connection to md1npdvlnx416:22. [04/15/24 06:11:13] [SSH] WARNING: SSH 
Host Keys are not being verified. Man-in-the-middle attacks may be possible 
against this connection. 
[04/15/24 06:11:13] [SSH] Authentication successful. [04/15/24 06:11:13] 
[SSH] The remote user's environment is: Checking Java version in the PATH 
Java is not in the PATH nor configured with the javaPath setting, Jenkins 
will try to guess where is Java, this guess will be removed in the future. 
:Launch agents via SSH [04/15/24 06:11:13] [SSH] Checking java version of 
/var/lib/jenkins/jenkins-agent/jdk/bin/java Couldn't figure out the Java 
version of /var/lib/jenkins/jenkins-agent/jdk/bin/java [04/15/24 06:11:13] 
[SSH] Checking java version of /etc/java/jdk-12.0.2+10/bin/java/bin/java 
Couldn't figure out the Java version of 
/etc/java/jdk-12.0.2+10/bin/java/bin/java [04/15/24 06:11:13] [SSH] 
Checking java version of /etc/java/jdk-12.0.2+10/bin/java/bin/java Couldn't 
figure out the Java version of /etc/java/jdk-12.0.2+10/bin/java/bin/java 
[04/15/24 06:11:13] [SSH] Checking java version of java Couldn't figure out 
the Java version of java [04/15/24 06:11:13] [SSH] Checking java version of 
/usr/bin/java Couldn't figure out the Java version of /usr/bin/java 
[04/15/24