简体   繁体   中英

Error While configuring Jenkins Controller and Agent using amazon EC2 instance

I'm trying to configure Jenkins Controller and Agent (maven server as agent node), but I'm getting an error while launching my node. This is the error

"Error: A JNI error has occurred, please check your installation and try again"

I have double-checked my configurations. created new user in maven and given it sudo access, configured ssh to allow password based authentication. I dont know what to do as I'm new to this concept. Please help me out.**

[09/24/22 16:28:17] [SSH] Opening SSH connection to 172.31.31.40:22.
[09/24/22 16:28:17] [SSH] WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection.
[09/24/22 16:28:17] [SSH] Authentication successful.
[09/24/22 16:28:17] [SSH] The remote user's environment is:
BASH=/usr/bin/bash
BASHOPTS=cmdhist:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_EXECUTION_STRING=set
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="4" [1]="2" [2]="46" [3]="2" [4]="release" [5]="x86_64-koji-linux-gnu")
BASH_VERSION='4.2.46(2)-release'
DIRSTACK=()
EUID=1001
GROUPS=()
HOME=/home/jenkins
HOSTNAME=ip-172-31-31-40.ec2.internal
HOSTTYPE=x86_64
IFS=$' \t\n'
LANG=en_US.UTF-8
LESSOPEN='||/usr/bin/lesspipe.sh %s'
LOGNAME=jenkins
MACHTYPE=x86_64-koji-linux-gnu
MAIL=/var/mail/jenkins
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/local/bin:/usr/bin
PIPESTATUS=([0]="0")
PPID=22937
PS4='+ '
PWD=/home/jenkins
SHELL=/bin/bash
SHELLOPTS=braceexpand:hashall:interactive-comments
SHLVL=1
SSH_CLIENT='172.31.93.109 40612 22'
SSH_CONNECTION='172.31.93.109 40612 172.31.31.40 22'
TERM=dumb
UID=1001
USER=jenkins
XDG_RUNTIME_DIR=/run/user/1001
XDG_SESSION_ID=56
_=/etc/bashrc
Checking Java version in the PATH
openjdk version "1.8.0_342"
OpenJDK Runtime Environment (build 1.8.0_342-b07)
OpenJDK 64-Bit Server VM (build 25.342-b07, mixed mode)
[09/24/22 16:28:17] [SSH] Checking java version of /home/jenkins/jdk/bin/java
Couldn't figure out the Java version of /home/jenkins/jdk/bin/java
bash: /home/jenkins/jdk/bin/java: No such file or directory

[09/24/22 16:28:17] [SSH] Checking java version of java
[09/24/22 16:28:17] [SSH] java -version returned 1.8.0_342.
[09/24/22 16:28:17] [SSH] Starting sftp client.
[09/24/22 16:28:17] [SSH] Copying latest remoting.jar...
Source agent hash is 8D575C4C8219E6AB2039295EC545C6C3. Installed agent hash is 8D575C4C8219E6AB2039295EC545C6C3
Verified agent jar. No update is necessary.
Expanded the channel window size to 4MB
[09/24/22 16:28:18] [SSH] Starting agent process: cd "/home/jenkins" && java  -jar remoting.jar -workDir /home/jenkins -jar-cache /home/jenkins/remoting/jarCache
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)
Agent JVM has terminated. Exit code=1
[09/24/22 16:28:18] Launch failed - cleaning up connection
[09/24/22 16:28:18] [SSH] Connection closed.```

截屏

The core error is pretty clear...

You have no JAVA_HOME defined as shown in the env dump, log shows: Launcher has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

In English, that means you are trying to run the agent on Java 8 (ie: java -version returned 1.8.0_342), when Java 11 is the required minimum for Jenkins 2.357+ / LTS 2.361.1+: Blog post , Enhancement Proposal , Upgrade Guide , Change Log , Community post w/ upgrade instructions

ps : you should also address : WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM