Incompatible magic value 1008813135
Asked Answered
C

7

27

I am writing a Java applet and embedding it in a web page. It used to run Mac and Windows in different browsers without problem. I was using NetBeans on the Mac to build the .jar file the applet used.

For some reason or another I decided to load the project on the Windows' NetBeans - I started getting the following error on the Windows machine when accessing the web page from any browser:

java.lang.ClassFormatError: Incompatible magic value 1008813135 in class file

Fearing that it must have been my decision to open the project on Windows that caused this error - I tried to build from the Mac's NetBeans - but the error persisted.

I started a while new project on the Mac and imported the existing source code: still same problem.

I was doing some reading about this error and it seems that the magic number expected is 0xCAFEBABE in hex which is 3405691582 in decimal, not 1008813135. So it looks like the Mac version of Java doesn't produce this file header any more? Hoe can that be? I didn't do any updates or anything.

Conclude answered 5/3, 2010 at 23:54 Comment(0)
M
61

Yes, 0xCAFEBABE is the usual first 4 bytes of a Java file.

1008813135 is <!DO in Latin encoding, which is, in all probability, the start of <!DOCTYPE....

It is therefore likely the start of a 404 error, or some other error page.

Matriculate answered 6/3, 2010 at 0:1 Comment(5)
Yeah, I found other reports of this error and it seems to have to do with invalid host configuration, possibly with respect to .jar files.Intoxicate
@Conclude I'd first attempt to load the applet jar file directly. If this works then it's possible you may have an incorrect path to the Jar file. View the server logs to see what URL the Jar file is attempted to be retrieve from.Matriculate
1008813135 is an integer? or hex?Connelly
The first 4 bytes are read into ints and converted, see grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/…Matriculate
If we have no access to the server, how can we get the full error text to see what the problem is?Pepperandsalt
I
6

I have not experienced this problem, but Googling this error yields several possible solutions:

forum.sun.com - Java Applet Development - Incompatible magic value 1008813135 in class file MyApplet

Thanks God the problem is solved.

Its the Java cache, so the solution go to Java Control Panel, "General" tab, and under "Temporary Internet Files" click "Settings", then click "Delete Files". Try using the applet again.

"Incompatible magic value 1008813135" Error?

The problem is now solved: I found out that the website host I was using didn't support .jar files at all. I mass-uploaded the files with my ftp program and didn't notice that it ignored the .jar files completely.

Errors on java initialization

Alright, so it was an apache configuration issue, removed this line from my httpd.conf file:

# DefaultType application/x-httpd-php

Fixed the issue.

Intoxicate answered 5/3, 2010 at 23:59 Comment(1)
I think the Java cache would be the theory to blame. The .jar support or apache config wouldn't make much sense because I am serving my web page from the ~/Sites folder on the Mac - and I changed nothing.Conclude
B
1

If you are using Spring security or some sort of custom Servlet Filters, make sure, that the archive or codebase location is in "permitAll" access. This was to problem in my case

Bedclothes answered 5/10, 2012 at 11:4 Comment(0)
R
0

The incompatible magic number is the first four bytes of a html file that has some error message in it, probably a message that the file isn't found.

I encountered this phenomenon when I didn't take case sensitivity into account in the codebase element of the applet tag. Things worked well on Windows, but the internet server I was using was running UNIX where filename case sensitivity is important. Making the case of all file and directory names in the code and codebase elements solved the problem.

Revere answered 20/6, 2012 at 16:45 Comment(1)
Thank you for answering, but this question was answered and accepted a looong time ago... You should try answering recent questions insteadTantra
F
0

I was facing the same problem.The reason in my case was all dependency library that Applet uses was not signed and also applet not able to locate them.

So i Have added all the dependent library along with main applet in jsp file like below :

app.archive = '/esense/resources/lib/Applet.jar, /esense/resources/lib/jasypt-1.7.jar, /esense/resources/lib/mysql-connector-java-5.1.30.jar, /esense/resources/lib/runtime-api-1.0.jar';

I have also signed all the jar.

Hope this may work in your case.

Fayina answered 27/11, 2014 at 6:54 Comment(0)
B
0

I just clicked on maven->update project->include snapshot release in my spring boot and it worked.

Builtin answered 9/6, 2018 at 13:17 Comment(0)
U
0

I was getting this error while using URLClassLoader to load a class from an URL. The URL i gave it was HTTP and on the server I had a HTTP to HTTPS redirect, and at class loading i would get this error.

How i fixed it is i first connect to the URL and check if i'm being redirected to HTTPS, if I am, i just change the URL i call to be HTTPS.

Unwritten answered 11/12, 2023 at 22:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.