Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Incompatible magic value

 
Samuel Quiring
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works fine for me. Which JVM are you using in your browser?
 
Samuel Quiring
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2602
13
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
...
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same on FF3.0.7, JRE 1.6.0_12
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a class file.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that 1013478509 is 3C68746D hex; if you take each byte as a Unicode character, you get "&lt;htm"


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic