Note that there are some explanatory texts on larger screens.

plurals
  1. POApplet won't run from GlassFish, Incompatible magic value. Runs fine from OS X web server
    primarykey
    data
    text
    <p>For a programming assignment, I am trying to have a GlassFish server serve up a client applet to talk to the server servlet. I've been stuck on having GlassFish deliver the applet. I have been searching extensively on this, and am not finding anything that resolves the issue - though I am learning quite a bit.</p> <p>I have a 'hello world' applet compiled to tskApplet.class. </p> <pre><code>import java.applet.Applet; import java.awt.*; public class tskApplet extends Applet { public void paint (Graphics g) { g.drawString("Hello world! It's an applet!", 5, 25); } } </code></pre> <p>I have an html page that loads the applet with the following applet tag:</p> <pre><code>&lt;applet code = "tskApplet.class" width="300" height="300"&gt;&lt;/applet&gt; </code></pre> <p>I've tried (to no avail) all sorts of variations such as putting the .class file in a .jar and including archive="tskApplet.jar" in the applet tag, and using a .jsp page, etc.</p> <p>I'm using IntelliJ and if I run the tskApplet from an applet run/debug configuration it works fine. I followed this guide to set up GlassFish with ImtelliJ: <a href="http://wiki.jetbrains.net/intellij/Developing_applications_for_GlassFish_Server_in_IntelliJ_IDEA" rel="nofollow">http://wiki.jetbrains.net/intellij/Developing_applications_for_GlassFish_Server_in_IntelliJ_IDEA</a></p> <p>If I copy the exact same .class file and .html file from the GlassFish server's web directory to the OS X Sites folder, then the applet works fine from the browser when I access it that way.</p> <p>But if I run GlassFish and access my web application, the applet does not run. Instead I get these errors in the browser java console:</p> <pre><code>java.lang.ClassFormatError: Incompatible magic value 1768779887 in class file tskApplet at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) at java.lang.ClassLoader.defineClass(ClassLoader.java:616) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:219) at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:249) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:179) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:160) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plugin2ClassLoader.java:674) at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:2990) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1481) at java.lang.Thread.run(Thread.java:680) </code></pre> <p>Any suggestions where to look next?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload