java.lang.ClassFormatError JVMCFRE076 bad magic number
08:54 29 Apr 2013

This question is partly solved. I will write about it since today google doesn’t provide that much help.

I have a webapp which is running fine on my local Ubuntu Linux Java environment. When I deploy it on a suse linux environment I get the following exception:

java.lang.RuntimeException: java.lang.ClassFormatError: JVMCFRE076 bad magic number;
class=com/package/util/MongodbUtil, offset=0 Error: java.lang.ClassFormatError: JVMCFRE076 bad magic number;
class=com/package/util/MongodbUtil, offset=0 /items added=0 /items deleted=0 /items unchanged=0

The problem derives from the Class name. The exception will only be thrown when it includes "Util" in the name. I renamed the Class to DbTool and it all worked fine. Digging a bit deeper it turned out that I can't include parts of the package name in the Class name.

I have a workaround which works, but I'm still interested to know why the exception was thrown and why it works on my local environment but not on the remote environment.

My local tomcat runs on open JDK 1.6.0_27 and the remote tomcat runs on IBM JRE 1_6_0. Both environments uses tomcat 6.36

java