简体   繁体   中英

Integrate Applet to Spring web application

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.

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.

> This should be a cache and compilation issue

Try Cleaning all your applets temp files from applet java console, re-compile and generate new jars, this should solve. I had this same issue and I solved using re compilation, generating jars and signing them using jarsigner.

If you convert the magic value reported by Java (218762506) into binary, that can help you work out what kind of file is being returned. In this case:

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

Probably the start of a text file, maybe even HTML, with a few empty lines to start off.

If you are able to download the jar successfully by pointing your browser directly to the file specified in your tag, then it's possible that there is a redirect happening behind the scenes that is tripping up the JVM. If possible, try using absolute URLs, at least to test it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM