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

Incompatible magic value

Samuel Quiring
Greenhorn

Joined: Feb 04, 2009
Posts: 8
I hope this is the right place -- I searched for about 10 minutes for somewhere to report a problem on javaranch.com.

This page: http://faq.javaranch.com/java/CodeBarnHelloServerFile
gets an exception (partially reproduced below) in the Java Console.

Good luck.

-Sam

PS. How did I get to that page?

I'm reading this exchange: http://www.coderanch.com/t/429389/Applets/java/Applet-Security-Exception#1906404

At the end Ulf Dittmer says... "see 'HelloServerFile in http://faq.javaranch.com/java/CodeBarnApplets ...".
I go there and the last entry in the table has a link to: HelloServerFile, linked to:

http://faq.javaranch.com/java/CodeBarnHelloServerFile

When I click on that link I get an exception partially reproduced below in the Java Console.


java.lang.ClassFormatError: Incompatible magic value 1013478509 in class file HelloServerFile
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.ClassFormatError: Incompatible magic value 1013478509 in class file HelloServerFile
Exception in thread "AWT-EventQueue-5" java.lang.NullPointerException: component argument pData

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42263
    
  64
Works fine for me. Which JVM are you using in your browser?


Ping & DNS - my free Android networking tools app
Samuel Quiring
Greenhorn

Joined: Feb 04, 2009
Posts: 8
Ulf Dittmer wrote:Works fine for me. Which JVM are you using in your browser?


I'm using Firefox 3.07. I do not know how to tell which JVM it is using. In the Tools->Add-ons window under Plugins it says:

Java(TM) Platform SE6 U11
- Java (TM) Platform SE binary
Java(TM) Platform SE 6 U11
- Java Plug-in 1.6.0_11 for Netscape Navigator (DLL Helper)
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2503
    
    8

Same for me with Google Chrome 1.0.154.48
Works on My IE 7.0.5730.13
Both browsers use the same Java 6 update 11 build 1.6.0_11-b03 plugin
While IE correctly shows This is line 1...etc,
Chrome errors with the same error as OP:



java.lang.ClassFormatError: Incompatible magic value 1013478509 in class file HelloServerFile
at java.lang.ClassLoader.defineClass1(Native Method)
...


OCUP UML fundamental and ITIL foundation
youtube channel
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Same on FF3.0.7, JRE 1.6.0_12


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Martijn Verburg wrote:Same on FF3.0.7, JRE 1.6.0_12


"Same" meaning that it works, or that it doesn't work? It works fine for me (FF 3.0.7/Mac), and there's no reason why it shouldn't work for anyone. Do other applets on other code barn pages work for you?


[Jess in Action][AskingGoodQuestions]
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Ernest Friedman-Hill wrote:
Martijn Verburg wrote:Same on FF3.0.7, JRE 1.6.0_12


"Same" meaning that it works, or that it doesn't work? It works fine for me (FF 3.0.7/Mac), and there's no reason why it shouldn't work for anyone. Do other applets on other code barn pages work for you?


Apologies that truly was a poor answer! Same as in 'it broke for me as well' with the same error. All other applets fail with a similar error message (Incompatible magic value 1013478509 in ...)
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Note that 1013478509 is 3C68746D hex; if you take each byte as a Unicode character, you get "<htm". So it looks like for the folks getting the error, your browser/firewall/something or other is returning an HTML page to Java rather than the applet class file! Perhaps your firewall or security policy is blocking .class files?>
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Oh, clever! It is possible, although I'm sure I was running applets from other sites OK, let me go check..... Hmm, other sites with Applets seem to work just fine for me.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42263
    
  64
Oh, Ernest doesn't just speak Elvish, he speaks Hex, too :-)

I suppose it's possible that the HTML page is actually returned by the JavaRanch server under some strange circumstances (seeing that it works with one browser for Jan, but not with another - which doesn't rule out a client-side problem, though).

Martijn (or anyone else who sees the problem), can you point the browser directly at http://faq.javaranch.com/codebarn/HelloServerFile.class to see what you get?
Samuel Quiring
Greenhorn

Joined: Feb 04, 2009
Posts: 8
Ulf Dittmer wrote:Oh, Ernest doesn't just speak Elvish, he speaks Hex, too :-)
...
Martijn (or anyone else who sees the problem), can you point the browser directly at http://faq.javaranch.com/codebarn/HelloServerFile.class to see what you get?


I think that is really excellent detective work. I not much of an expert in HTTP traffic to figure the implications, however.

As far as pointing the browser at ... HelloServerFile.class, I clicked on the link and FF 3.0.7 brings up a dialog titled "Opening HelloServerFile.class" saying "you have chosen to open HelloServerFile.class which is a CLASS file... What should Firefox do with this file:

Open With <Browse... button>
Save File
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Samuel Quiring wrote:
Ulf Dittmer wrote:Oh, Ernest doesn't just speak Elvish, he speaks Hex, too :-)
...
Martijn (or anyone else who sees the problem), can you point the browser directly at http://faq.javaranch.com/codebarn/HelloServerFile.class to see what you get?


I think that is really excellent detective work. I not much of an expert in HTTP traffic to figure the implications, however.

As far as pointing the browser at ... HelloServerFile.class, I clicked on the link and FF 3.0.7 brings up a dialog titled "Opening HelloServerFile.class" saying "you have chosen to open HelloServerFile.class which is a CLASS file... What should Firefox do with this file:

Open With <Browse... button>
Save File


I get the same as Samuel
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42263
    
  64
Samuel Quiring wrote:As far as pointing the browser at ... HelloServerFile.class, I clicked on the link and FF 3.0.7 brings up a dialog...

The interesting part is what is *inside* of that file - is it a class file (apparently not)? Or is at an HTML file like Ernest suspects? And if it is an HTML file, what's in it? So if one of you could save the file contents, and post them here, that would be cool.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

It's a class file.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Note that 1013478509 is 3C68746D hex; if you take each byte as a Unicode character, you get "&lt;htm"




SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Incompatible magic value