简体   繁体   English

将Applet集成到Spring Web应用程序

[英]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. 我有一个Spring Web应用程序,我正在尝试将applet集成到jsp页面中。

Here is the code where i call the applet. 这是我称之为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. 加载jsp页面后,JVM控制台会向我显示此错误。

    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. 如果有帮助,我可以使用eclipse和tomcat来实现我的应用程序和applet。

The most likely cause is that your web application is not actually serving the jar files as you think it is. 最可能的原因是您的Web应用程序实际上并未按您认为的那样提供jar文件。 Try hitting those urls with your web browser, or curl, or wget, and see what you get. 尝试使用网络浏览器访问这些网址,或者卷曲或wget,然后看看会得到什么。 I'm guessing that the result is an html-formatted error message, not the jar file. 我猜测结果是html格式的错误消息,而不是jar文件。

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. 另一种可能性较小的是,该小程序是使用比试图运行它的Java vm高得多的版本编译的。

> 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. 尝试从applet java控制台清除所有applet临时文件,重新编译并生成新的jar,这应该可以解决。 I had this same issue and I solved using re compilation, generating jars and signing them using jarsigner. 我遇到了同样的问题,我使用重新编译,生成jar并使用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. 如果将Java(218762506)报告的不可思议值转换为二进制值,则可以帮助您确定要返回的文件类型。 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. 可能是一个文本文件(甚至是HTML)的开始,并且有一些空行开始。

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. 如果能够通过直接将浏览器指向标签中指定的文件来成功下载jar,则可能是在后台触发了JVM重定向。 If possible, try using absolute URLs, at least to test it. 如果可能,请尝试使用绝对URL,至少要对其进行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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