File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Incompatible magic value, ahem ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Applets
Reply Bookmark "Incompatible magic value, ahem ?" Watch "Incompatible magic value, ahem ?" New topic
Author

Incompatible magic value, ahem ?

Morten Frost
Greenhorn

Joined: Oct 02, 2006
Posts: 1
Hey there

I have stumpled upon a problem I have never encountered before.
It has to do with the execution of an Applet.

Now...
I have three .jars:
- a.jar (The actual testing applet)
- commons-logging-api.jar
- jmimemagic-0.1.0.jar

commons-logging-api.jar and jmimemagic-0.1.0.jar are external libraries which is used throughout the main applet code. I have placed these libraries on a webserver, and link directly to them at their server location in the applet "archive" attribute. (archive="a.jar,http://....../jmimemagic-0.1.0.jar, http://....../commons-logging-api.jar).

If I run the applet locally, everything executes as expected, but once I move "a.jar" to the server aswell, I receive this weird error: "Incompatible magic value".

Stacktrace follows:
Exception in thread "Thread-1989" java.lang.ClassFormatError: Incompatible magic value 537528842 in class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.apache.commons.logging.LogFactory$2.run(LogFactory.java:571)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:561)
at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:332)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
at net.sf.jmimemagic.Magic.<clinit>(Magic.java:46)

Any help would be much appreciated.

Regards,
Morten
Meghna Bhardwaj
Ranch Hand

Joined: Jun 08, 2007
Posts: 109
Hi,

I realize this is an old issues however, I just ahd the same problem and wanted to post a reply so it might help others who are experienceing this.

I had 2 versions of Java installed 1.4 and 1.6 and was getting this error about java.lang.ClassFormatError: Incompatible magic value

I just uninstalled Java 1.4 from Start->Control panel-> Add/remove programs and restarted my machine. The error went away instantly.

Regards.
 
jQuery in Action, 2nd edition
 
subject: Incompatible magic value, ahem ?
 
Threads others viewed
Jnlp cannot find the main class in a Jar packaged using "OneJar".
Jobfuscate
FTPclient by org.apache.commons hangup...
error in applet notinited
Applet only works with one Java version
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture