Page 1 of 1

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

Posted: Tue Feb 07, 2017 4:49 am
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

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

Posted: Tue Feb 07, 2017 10:43 am
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.

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

Posted: Tue Feb 07, 2017 11:09 am
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)

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

Posted: Tue Feb 07, 2017 12:55 pm
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

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

Posted: Wed Feb 08, 2017 4:21 am
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$

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

Posted: Wed Feb 08, 2017 10:30 am
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.

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

Posted: Wed Mar 01, 2017 2:24 pm
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?