Ad Widget

Collapse

What’s the required JRE version for zabbix-java-gateway?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Matthias R
    Junior Member
    • Jul 2012
    • 19

    #1

    What’s the required JRE version for zabbix-java-gateway?

    I am setting up a Zabbix environment on Ubuntu 18.04 LTS (Bionic) and installed zabbix-java-gateway from the package repository. The service fails to start, this is what I get from journalctl -xe:

    Jun 26 09:31:56 zabbix-mon-srv systemd[1]: Starting Zabbix Java Gateway...
    -- Subject: Unit zabbix-java-gateway.service has begun start-up
    -- Defined-By: systemd
    -- Support: http://www.ubuntu.com/support
    --
    -- Unit zabbix-java-gateway.service has begun starting up.
    Jun 26 09:31:56 zabbix-mon-srv zabbix_java_gateway[24234]: Error: A JNI error has occurred, please check your installation and try again
    Jun 26 09:31:56 zabbix-mon-srv zabbix_java_gateway[24234]: Exception in thread "main" java.lang.UnsupportedClassVersionError: com/zabbix/gateway/JavaGateway has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0
    Jun 26 09:31:56 zabbix-mon-srv zabbix_java_gateway[24234]: at java.lang.ClassLoader.defineClass1(Native Method)
    Jun 26 09:31:56 zabbix-mon-srv zabbix_java_gateway[24234]: at java.lang.ClassLoader.defineClass(ClassLoader.java :763)
    Jun 26 09:31:56 zabbix-mon-srv zabbix_java_gateway[24234]: at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:142)
    Jun 26 09:31:56 zabbix-mon-srv zabbix_java_gateway[24234]: at java.net.URLClassLoader.defineClass(URLClassLoader .java:467)
    Jun 26 09:31:56 zabbix-mon-srv zabbix_java_gateway[24234]: at java.net.URLClassLoader.access$100(URLClassLoader. java:73)
    Jun 26 09:31:56 zabbix-mon-srv zabbix_java_gateway[24234]: at java.net.URLClassLoader$1.run(URLClassLoader.java: 368)
    Jun 26 09:31:56 zabbix-mon-srv zabbix_java_gateway[24234]: at java.net.URLClassLoader$1.run(URLClassLoader.java: 362)
    Jun 26 09:31:56 zabbix-mon-srv zabbix_java_gateway[24234]: at java.security.AccessController.doPrivileged(Native Method)
    Jun 26 09:31:56 zabbix-mon-srv zabbix_java_gateway[24234]: at java.net.URLClassLoader.findClass(URLClassLoader.j ava:361)
    Jun 26 09:31:56 zabbix-mon-srv zabbix_java_gateway[24234]: at java.lang.ClassLoader.loadClass(ClassLoader.java:4 24)
    Jun 26 09:31:56 zabbix-mon-srv zabbix_java_gateway[24234]: at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:349)
    Jun 26 09:31:56 zabbix-mon-srv zabbix_java_gateway[24234]: at java.lang.ClassLoader.loadClass(ClassLoader.java:3 57)
    Jun 26 09:31:56 zabbix-mon-srv zabbix_java_gateway[24234]: at sun.launcher.LauncherHelper.checkAndLoadMain(Launc herHelper.java:495)
    Jun 26 09:31:56 zabbix-mon-srv systemd[1]: zabbix-java-gateway.service: New main PID 24246 does not exist or is a zombie.
    Jun 26 09:33:26 zabbix-mon-srv systemd[1]: zabbix-java-gateway.service: Start operation timed out. Terminating.
    Jun 26 09:33:26 zabbix-mon-srv systemd[1]: zabbix-java-gateway.service: Failed with result 'timeout'.
    Jun 26 09:33:26 zabbix-mon-srv systemd[1]: Failed to start Zabbix Java Gateway.
    -- Subject: Unit zabbix-java-gateway.service has failed
    -- Defined-By: systemd
    -- Support: http://www.ubuntu.com/support
    --
    -- Unit zabbix-java-gateway.service has failed.
    --
    -- The result is RESULT.


    My java version:
    $ java -version
    openjdk version "1.8.0_171"
    OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.18.04.1-b11)
    OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)


    My Zabbix Java Gateway version:
    $ find / -xdev -name 'zabbix-java-gateway*.jar' 2>/dev/null
    /usr/share/zabbix-java-gateway/bin/zabbix-java-gateway-4.0.0alpha8.jar


    What is the minimum required JRE version required for the different versions Zabbix Java Bridge? I was not able to find a list. I would also be very thankful for any tips how to approach to this problem.
  • kernbug
    Senior Member
    • Feb 2013
    • 330

    #2
    Originally posted by Matthias R

    What is the minimum required JRE version required for the different versions Zabbix Java Bridge? I was not able to find a list. I would also be very thankful for any tips how to approach to this problem.
    Hi,

    Please, run 'sudo update-alternatives --config java' and show output.

    Comment

    • chandankashyap
      Junior Member
      • Oct 2018
      • 3

      #3
      I have same same issue on Ubuntu 16.04 LTS. My gateway version is " /usr/share/zabbix-java-gateway/bin/zabbix-java-gateway-3.4.14.jar" and sudo update-alternatives --config java' shows
      here are 2 choices for the alternative java (providing /usr/bin/java).
      Selection Path Priority Status------------------------------------------------------------
      0 /opt/java/jdk1.8.0_131/bin/java 100 auto mode
      1 /opt/java/jdk1.8.0_131/bin/java 100 manual mode
      * 2 /usr/lib/jvm/java-ibm-x86_64-80/jre/bin/java 80 manual mode

      Comment

      • bennetcole
        Junior Member
        • Sep 2019
        • 1

        #4
        To fix the actual problem you should try to either run the Java code with a newer version of Java JRE or specify the target parameter to the Java compiler to instruct the compiler to create code compatible with earlier Java versions.

        For example, in order to generate class files compatible with Java 1.4, use the following command line:
        javac -target 1.4 HelloWorld.java
        With newer versions of the Java compiler you are likely to get a warning about the bootstrap class path not being set.

        how to set path in java? Java PATH is the environment variable where we specify the locations of binaries. CLASSPATH is the path for Java application where the classes you compiled will be available.How to use a wildcard in the classpath to add multiple jars How to Set Classpath for Java on Windows How do I set or change the PATH system variable

        Comment

        • tkot
          Junior Member
          • Jul 2019
          • 4

          #5
          Sorry that I might sound off-topic, but I would like to comment about the MAXIMUM java version that works well with the java GW.

          Recently I lost two days trying to figure out why a Zabbix installation monitoring some Wildfly (version 16) servers, although it was a complete copy of another system that did work, failed to monitor all JMX items.
          The logs were not helpful even at the deepest level. I snooped the messages exchanged in each case and I discovered that all went smooth as far as the connectivity is concerned between the GW and Zabbix server, only that the response JSON was empty! The Wildfly itself would only report some very low level issue, like a socket that was down etc.
          Upgrading Zabbix (server and GW) from 4.2.1 to 4.2.4 did not change anything.

          Eventually I realized that the problematic system had JDK11 running for both the Wildfly AND the java GW. The other system, the working one, had the same JDK11 for Wildfly but JDK8 for the java GW!
          So I changed the new system to run the GW with JDK8 and all worked smoothly!

          Apparently something has changed in the JMX connection factory in JDK11 and the GW, EVEN when working with a target system running the same JDK11, it somehow fails. I didn't investigate any further, so I wish somebody from Zabbix would take notice of this and discover the real cause, or at least make a warning comment.

          So, to make the long story short, stick with JDK8 for the moment. It seems to be both the minimum and the maximum version. To ensure that you run the appropriate java version in linux, add in the [Service] section of the /lib/systemd/system/zabbix-java-gateway.service the following:
          Code:
          Environment="JAVA=<JDK8 path>/bin/java"
          and you will be fine. This is an alternative than setting the default java executable, as you may need to stick to another version as default in your system.

          Comment

          Working...