OpenNMS 29 installation stuck on RHEL7 not finding java

Hi,
Iam trying to install opennms 29 on RHEL7 in order to test it and compare it with the old version we use in our project for a futur migration but iam struggling on a problem i followed all steps in the documentations but when i run yum install opennms it sticks on opennms installing :

Install  1 Package (+2 Dependent packages)

Total size: 614 M
Installed size: 822 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : opennms-core-29.0.5-1.noarch                                                                                                              1/3
^C* fixing ownership of /opt/opennms
* fixing ownership of /var/opennms
* fixing ownership of /var/log/opennms
- making symlink for /opt/opennms/logs... done
* fixing ownership of /opt/opennms/logs
- making symlink for /opt/opennms/share... done
* fixing ownership of /opt/opennms/share
* fixing ownership of /opt/opennms/share/etc-pristine
* fixing ownership of /opt/opennms/share/mibs
* fixing ownership of /opt/opennms/share/reports
* fixing ownership of /opt/opennms/share/rrd
* fixing ownership of /opt/opennms/share/sftp
* fixing ownership of /opt/opennms/share/version
* fixing ownership of /opt/opennms/share/xsds
- moving *.sql.rpmnew files (if any)... done
- checking for old update files... done
* fixing ownership of /opt/opennms/etc/libraries.properties
- cleaning up $OPENNMS_HOME/data... done
runjava: Looking for an appropriate JVM...
runjava: Checking for an appropriate JVM in JAVA_HOME...
runjava: Skipping... JAVA_HOME not set.
runjava: Checking JVM in the PATH: "/etc/alternatives/java"...
runjava: Did not find an appropriate JVM in the PATH: "/etc/alternatives/java"
runjava: Searching for a good JVM...
warning: %post(opennms-core-29.0.5-1.noarch) scriptlet failed, signal 2
Non-fatal POSTIN scriptlet failure in rpm package opennms-core-29.0.5-1.noarch

i setup java 11 as mentionned with JAVA_HOME for all user

[root@SERVER]# echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-11.0.14.0.9-1.el7_9.x86_64

java is totally accessible and works fine

[root@SERVER~]# java --version
openjdk 11.0.14 2022-01-18 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.14+9-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.14+9-LTS, mixed mode, sharing)

I tried to run the bin to detect java but it seems corrupt it loops infinitly searching for a suitable java

[root@SERVER bin]# ./runjava -s
runjava: Looking for an appropriate JVM...
runjava: Checking for an appropriate JVM in JAVA_HOME...
runjava: Skipping... JAVA_HOME not set.
runjava: Checking JVM in the PATH: "/etc/alternatives/java"...
runjava: Did not find an appropriate JVM in the PATH: "/etc/alternatives/java"
runjava: Searching for a good JVM...

i noticed that opennms created a user opennms and setup all permissions of /opt/opennms to that user, and i run installation with root account.

Any ideas please ?

Never seen that before.

Try running $OPENNMS_HOME/bin/runjava -S /usr/lib/jvm/java-11-openjdk-11.0.14.0.9-1.el7_9.x86_64/bin/java (note the capital S)

1 Like

same result as before i don’t know why it does not recognize the JVM, i installed the 28.1.1 and it works without issues

Can you share the content of your /usr/lib/jvm directory? With the runjava -S command @dino2gnt explained, you don’t try to autodetect the installed JDK you can set it manually by giving the path accordingly. That should definitely solve that issue.

ll /usr/lib/jvm

total 8
lrwxrwxrwx 1 root root 26 Mar 20 19:00 java β†’ /etc/alternatives/java_sdk
lrwxrwxrwx 1 root root 29 Mar 20 19:00 java-11 β†’ /etc/alternatives/java_sdk_11
lrwxrwxrwx 1 root root 37 Mar 20 19:00 java-11-openjdk β†’ /etc/alternatives/java_sdk_11_openjdk
drwxr-xr-x 6 root root 4096 Mar 20 19:00 java-11-openjdk-11.0.14.1.1-1.el7_9.i386
drwxr-xr-x 8 root root 4096 Mar 20 19:00 java-11-openjdk-11.0.14.1.1-1.el7_9.x86_64
lrwxrwxrwx 1 root root 34 Mar 20 19:00 java-openjdk β†’ /etc/alternatives/java_sdk_openjdk
lrwxrwxrwx 1 root root 21 Mar 20 19:01 jre β†’ /etc/alternatives/jre
lrwxrwxrwx 1 root root 24 Mar 20 19:01 jre-11 β†’ /etc/alternatives/jre_11
lrwxrwxrwx 1 root root 32 Mar 20 19:01 jre-11-openjdk β†’ /etc/alternatives/jre_11_openjdk
lrwxrwxrwx 1 root root 40 Mar 20 19:00 jre-11-openjdk-11.0.14.1.1-1.el7_9.i386 β†’ java-11-openjdk-11.0.14.1.1-1.el7_9.i386
lrwxrwxrwx 1 root root 42 Mar 20 19:00 jre-11-openjdk-11.0.14.1.1-1.el7_9.x86_64 β†’ java-11-openjdk-11.0.14.1.1-1.el7_9.x86_64
lrwxrwxrwx 1 root root 29 Mar 20 19:01 jre-openjdk β†’ /etc/alternatives/jre_openjdk

Solved by giving the path of the jvm directly
Thank you