我试图在运行树脂的localhost中运行Java applet。我有一个JSP文件applet2.jsp,其中包含以下行:
Testing an applet.
<IMG SRC="/static/images/tabTrackerRollM.gif"><BR>
<APPLET NAME="tracker" CODE="com.my.package" ARCHIVE="/applets/my_applet.jar" WIDTH="100%" HEIGHT="300" VIEWASTEXT MAYSCRIPT>
<param name=updateUrl value="http://localhost/test/appletSample3.jsp">
<param name=bgColor value="0,0,0">
<param name=updateFrequency value=4000>
</APPLET>
但是,每当我尝试在浏览器中运行applet时,我总会收到以下错误消息:
检查Java控制台后,我发现了以下内容:
cache: Initialize resource manager: com.sun.deploy.cache.ResourceProviderImpl@9da1dd
basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@1a0d62f
security: Expected Main URL: http://localhost/applet/my_applet.jar.jar
basic: Plugin2ClassLoader.addURL parent called for http://localhost/applet/my_applet.jar
network: Cache entry not found [url: http://localhost/applet/my_applet.jar, version: null]
network: Connecting http://localhost/applet/my_applet.jar with proxy=DIRECT
network: Connecting http://localhost:80/ with proxy=DIRECT
java.io.FileNotFoundException: http://localhost/applet/my_applet.jar
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.plugin.PluginURLJarFileCallBack.downloadJAR(Unknown Source)
at sun.plugin.PluginURLJarFileCallBack.access$000(Unknown Source)
at sun.plugin.PluginURLJarFileCallBack$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.PluginURLJarFileCallBack.retrieve(Unknown Source)
at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown Source)
at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFileInternal(Unknown Source)
at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$1000(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(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.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.initAppletAdapter(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
它基本上说my_applet.jar丢失了。但是当我尝试通过指向http://localhost/applet/my_applet.jar使用我的浏览器访问它时,它确实存在:
我也试过去Java.com检查我是否有最新的Java:
我在以下平台上: 操作系统:Windows 7(64) Java: JDK 1.7(64)
我还清除了控制面板中的java applet缓存,将浏览器安全性设置为中等并清除浏览器缓存。
答案 0 :(得分:1)
我们必须在浏览器上运行它之前签署applet你尝试签署你的applet Jar吗? 这是签名命令。
您应该在命令提示符下位于同一目录中。
1.keytool -genkey -keyalg rsa -alias m4key //m4key unique key
2.keytool -export -alias m4key -file bmcert.crt //bmcert.crt certificate name
3.jar tvf Jarname.jar verify jar
4.jarsigner Jarname.jar m4key
5.jarsigner -verify -verbose -certs JarnameJarname.jar