Jul 062012

While starting a Jboss process I am getting “Bad version number in .class file” error. What is the root cause?

 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:620)
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:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

Check whether the class or jar file compiled with a higher version of java than the Jre running the jboss server. This can be checked by doing a “java -version” in the application server machine and check the MANIFEST.MF file in jar file.

Usually java is not backward compatible, so if the jar file is complied with higher version of java than the java running the application server process this issue occurs. To avoid this issue recompile the jar with the same version of java which runs the app server process. E.g: If 1.5.x JDK is used to run Java app server process then compiling the jar file with same 1.5.x JDK solves the issue

Ramakanta Sahoo

A Middleware Consultant, skilled in project implementation of J2EE Applications on Application Servers like WebSphere, WebLogic, JBoss and Tomcat, etc. My job includes Infrastructure Planning, Design, Administrative Developments, support, Installation, Configuration, Failover, High Availability, Performance Monitoring/Tuning, Analyzing and Debugging server/application/platform issues.

Follow Me:
TwitterFacebookGoogle Plus

© Incase of any copyright infringements please check copyrights page for faster resolutions.

Leave a Reply