Can't update wazuh because of java

92 views
Skip to first unread message

Cézar

unread,
Aug 22, 2024, 3:17:43 PM8/22/24
to Wazuh | Mailing List
Hello guys,

I am trying to update wazuh from version 4.4 to 4.8. And I am getting this error while I try to update indexer:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/opensearch/tools/java_version_checker/JavaVersionChecker 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:621)
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/opensearch/tools/java_version_checker/JavaVersionChecker 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:621)
dpkg: error processing package wazuh-indexer (--configure):
installed wazuh-indexer package post-installation script subprocess returned error exit status 1

I tried to install openjdk 11 (current version was 8), but still got this error.

Any leads what I can try?


I had updated wazuh before, but this is the first time I got an error with Java.



Thanks for your support,

Yours faithfully,

Cézar

Kasim Mustapha

unread,
Aug 28, 2024, 3:20:48 PM8/28/24
to Wazuh | Mailing List
Hello  Cézar,

I've tried to replicate this issue but have yet to succeed. 

Which OS are you running the wazuh components on? I would strongly suggest using one of the recommended ones in the link below.
https://documentation.wazuh.com/current/installation-guide/wazuh-indexer/index.html#recommended-operating-systems

What kind of deployment do you have? Is it containerized?
Also, what are the specifications of the machine(s)?

Kindly share the output of the following commands;

cat /etc/wazuh-indexer/jvm.options | grep "Xm"
cat /etc/wazuh-dashboard/opensearch_dashboards.yml | grep "defaultRoute"

I will be waiting for you to reply.

Thanks.

Kasim Mustapha

unread,
Aug 28, 2024, 5:43:19 PM8/28/24
to Wazuh | Mailing List
Hello  Cézar,

Another you can do is point the indexer to the installed JAVA 11 path instead.

# systemctl edit --full wazuh-indexer
[Service]
Type=notify
RuntimeDirectory=wazuh-indexer
PrivateTmp=yes
Environment=OPENSEARCH_HOME=/usr/share/wazuh-indexer
Environment=OPENSEARCH_PATH_CONF=/etc/wazuh-indexer
Environment=PID_DIR=/run/wazuh-indexer
Environment=OPENSEARCH_SD_NOTIFY=true
EnvironmentFile=-/etc/sysconfig/wazuh-indexer
Environment=JAVA_HOME=/usr/lib/jvm/jdk-11.0.4
...


You need to add the path specified above with your correct file name.

Then;
# systemctl daemon-reload
# systemctl restart wazuh-indexer

Let me know if this works for you.

Thank you.

Juliano Nascimento

unread,
Aug 29, 2024, 12:08:46 AM8/29/24
to Wazuh | Mailing List
This issue can be resolved by adjusting the environment variables with the following commands:

export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
Reply all
Reply to author
Forward
0 new messages