• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Incompatible magic value

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: https://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

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
...
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Same on FF3.0.7, JRE 1.6.0_12
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's a class file.
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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



 
I'd appreciate it if you pronounced my name correctly. Pinhead, with a silent "H". Petite ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic