JMX Memory error"Bad version number in .class file"

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Chinmay
Posts: 3
Joined: Mon Feb 06, 2017 10:29 am

JMX Memory error"Bad version number in .class file"

Post by Chinmay »

Hi,

I am trying to run JMX memory command on my remote server and getting the below output.

root@ssb-voor-01 etc$ /apps/nagios/libexec/nagios-jmx-plugin-1.2.3/check_jmx -U service:jmx:rmi:///jndi/rmi://168.162.97.143:7780/jmxrmi -O jboss.system:type=ServerInfo -A TotalMemory -w 3247300864 -c 3251495168
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

I am using the following version on JMX plugin

drwxrwxrwx 2 nagios nagios 512 Jan 30 03:10 nagios-jmx-plugin-1.2.3
root@ssb-voor-01 libexec$ pwd
/apps/nagios/libexec
root@ssb-voor-01 libexec$

Please suggest if anything is wrong with my configuration or plugin.
Attching the nrpe.cfg file
Attachments
nrpe.cfg
(8.33 KiB) Downloaded 298 times
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: JMX Memory error"Bad version number in .class file"

Post by mcapra »

I'm going to assume you didn't compile this plugin yourself? Can you share where you downloaded the plugin from? It may need to be recompiled to match your system's Java version.

From the system you're trying to run the JMX plugin from, can you share the output of the following command executed from the CLI:

Code: Select all

java -version
Or if you already know the JRE version this system is using, that would be helpful to share.
Former Nagios employee
https://www.mcapra.com/
Chinmay
Posts: 3
Joined: Mon Feb 06, 2017 10:29 am

Re: JMX Memory error"Bad version number in .class file"

Post by Chinmay »

Hi,

I will confirm about the source of this plugin from where it was downloaded.

Regarding your second query:

ssb-voor-01 $ java -version
java version "1.5.0_24"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_24-b02)
Java HotSpot(TM) Server VM (build 1.5.0_24-b02, mixed mode)
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: JMX Memory error"Bad version number in .class file"

Post by rkennedy »

Can you attempt to compile it on your own, and see if it works at that point?

It can be downloaded here - https://exchange.nagios.org/directory/P ... mx/details
Former Nagios Employee
Chinmay
Posts: 3
Joined: Mon Feb 06, 2017 10:29 am

Re: JMX Memory error"Bad version number in .class file"

Post by Chinmay »

Okay,

I will do that and update. Meanwhile, I just have another query, the same plugin is working fine on all other remote servers.
Here is an example

-bash-3.2$ /usr/local/nagios/libexec/nagios-jmx-plugin-1.2.3/check_jmx -U service:jmx:rmi:///jndi/rmi://10.146.1.37:7780/jmxrmi -O jboss.system:type=ServerInfo -A TotalMemory -w 3247300864 -c 3251495168
JMX OK - TotalMemory = 3081764864 | 'TotalMemory'=3081764864;3247300864;3251495168;;
-bash-3.2$ java -version
java version "1.6.0_131"
Java(TM) SE Runtime Environment (build 1.6.0_131-b14)
Java HotSpot(TM) Server VM (build 20.131-b14, mixed mode)
-bash-3.2$
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: JMX Memory error"Bad version number in .class file"

Post by rkennedy »

The other option may be to upgrade your java. Based on the different versions, it'd be my guess that the plugin is compiled for 1.6.0, where as your other system is only running 1.5.0.
Former Nagios Employee
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: JMX Memory error"Bad version number in .class file"

Post by tmcdonald »

Just checking in since we have not heard from you in a while. Did @rkennedy's post clear things up or has the issue otherwise been resolved?
Former Nagios employee
Locked