1

sorry about my english.

I have a problem and i cant find any solution. I have a spring web application and im trying integrate an applet to a jsp page.

Here is the code where i call the applet.

    <object type="application/x-java-applet;version=1.6" width="200" height="200" title="Java"><param name="code" value="cl.facele.sign.applet.WebSignApplet.class">
    <param name="archive" value="/frontend-1.4/lib/fea-signer-0.94.jar, /frontend-1.4/lib/httpcore-4.0.1.jar, /frontend-1.4/lib/httpmime-4.0.jar, /frontend-1.4/lib/apache-mime4j-0.6.jar, /frontend-1.4/lib/commons-codec-1.3.jar, /frontend-1.4/lib/httpclient-4.0.jar, /frontend-1.4/lib/commons-logging-1.1.1.jar"><param name="XML_IDS" value="{xmlIds}">
    <param name="DOCS_IDS" value="{docsIds}"><param name="WS_URL_SERVER" value="http://localhost:8080/efactoryapp">
    <param name="WS_GET_DOC_METHOD" value="/services.htm?faction=getDocument&amp;id=">
    <param name="WS_POST_DOC_METHOD" value="/services.htm?        faction=addDocumentDeclarado">
    <param name="urlRefreshTarget" value="">Para utilizar la componente de firma electrónica debe instalar plugin <a href="http://java.sun.com/update/1.6.0/jinstall-6u22-windows-i586.cab">Java v.1.6</a>
    </object>

When the jsp page is loaded the JVM console show me this error.

    java.lang.ClassFormatError: Incompatible magic value 218762506 in class file cl/facele/sign/applet/WebSignApplet
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.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)
    Excepción: java.lang.ClassFormatError: Incompatible magic value 218762506 in class file cl/facele/sign/applet/WebSignApplet
    java.lang.ClassFormatError: Incompatible magic value 218762506 in class file         cl/facele/sign/applet/WebSignApplet
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.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)
    Excepción: java.lang.ClassFormatError: Incompatible magic value 218762506 in class file cl/facele/sign/applet/WebSignApplet

Thank you for any help!

UPDATE:

If this help, im implementing my application and my applet with eclipse and tomcat.

4

3 回答 3

1

The most likely cause is that your web application is not actually serving the jar files as you think it is. Try hitting those urls with your web browser, or curl, or wget, and see what you get. I'm guessing that the result is an html-formatted error message, not the jar file.

There's a full explanation here

The other, less likely possibility is that the applet was compiled with a much later version of the Java vm than the one that's trying to run it.

于 2012-10-28T20:22:09.373 回答
0

> 这应该是缓存和编译问题

尝试从 applet java 控制台清理所有 applet 临时文件,重新编译并生成新的 jar,这应该可以解决。我遇到了同样的问题,我使用重新编译、生成 jar 并使用 jarsigner 对其进行签名解决了。

于 2014-11-17T07:10:33.473 回答
0

如果您将 Java 报告的魔法值 (218762506) 转换为二进制,则可以帮助您确定返回的文件类型。在这种情况下:

0000 1101 = 13 - Carriage Return
0000 1010 = 10 - New Line
0000 1101 = 13 - Carriage Return
0000 1010 = 10 - New Line

可能是文本文件的开头,甚至可能是 HTML,开头有几行空。

如果您能够通过将浏览器直接指向标签中指定的文件来成功下载 jar,那么可能是在幕后发生了重定向,导致 JVM 跳闸。如果可能,请尝试使用绝对 URL,至少对其进行测试。

于 2015-10-21T11:24:08.180 回答