Java小程序的部署,ClassNotFoundException的(初级班) [英] Java Applet Deployment, ClassNotFoundException (primary class)

查看:166
本文介绍了Java小程序的部署,ClassNotFoundException的(初级班)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是推动我逼疯了。我已经检查和复查的拼写和路径。我曾经尝试过的路径,包括相对的,绝对的,完整的HTTP路径,每个组合。我继续得到以下错误尝试加载Java小程序时:

This is driving me up the wall. I have checked and rechecked spelling and paths. I have tried just about every combination of paths, including relative, absolute, and full http paths. I continue to get the following error when trying to load a Java applet:

java.lang.ClassNotFoundException: AppletClient.class
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.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)
Exception: java.lang.ClassNotFoundException: AppletClient.class

用于加载applet的HTML:

The HTML used to load the applet:

<applet width="100" height="100" archive="applet/myapplet.jar, applet/applet_dependency.jar" code="AppletClient.class">
    <param value="blahblah" name="username">
    <param value="false" name="codebase_lookup">
</applet>

该小程序是在一个相对目录,小程序,从当前页面的路径。我解压缩的jar文件,可以看到AppletClient.class。此外,在该项目的源,其拼写这种方式(壳体和全部)。我曾与/尝试没有参数。我已经改变了applet的归档罐子的名字包括标签只是为了看看,如果我得到一个不同的错误错误的文件名(同样的错误)。

The applet is in a relative directory, "applet", from the path of the current page. I have unzipped the jar file and can see AppletClient.class. Also, in the source of the project, it is spelled that way (casing and all). I have tried with/without the parameters. I have changed the names of the archive jars in the applet include tag just to see if I get a different error for bad file names (same error).

我已经手工完成大干快上的罐子,以确保服务器响应请求(它是)。

I have manually done GETs on the jars to make sure the server is responding to the requests (it is).

我已经(开始让那些坏幻数的错误)。

I have tried with and without the codebase tag, with all different varieties of paths (start getting bad "magic number" errors on those).

我知道,当一个依赖加载失败这个错误有时会弹出,因此它可能会产生误导,但所有的依赖是present,占,并通过人工可取出是GET的。

I know that this error sometimes pops up when a dependency fails to load, so it can be misleading, but all dependencies are present, accounted for, and are fetchable via manual GETs.

每一个尝试之间,我总是清楚我在FireFox缓存。这些问题在IE8和Chrome转载为好。

Between each and every attempt I always clear my cache in FireFox. These problems are reproduced in IE8 and Chrome as well.

按我的Java控制台从浏览器,我运行Java插件1.6.0_20。这是我开发的小程序在同一台机器,它通过Eclipse运行正常。

Per my Java Console from the browser, I am running Java Plug-in 1.6.0_20. This is from the same machine that I develop the applet on, which runs fine via Eclipse.

最后,我踢Fiddler2,我没有看到的jar文件的任何地方主机网站从我的Visual Studio调试器中运行单个请求,所以它的本地主机上运行。但是,我看到在提琴手的所有其他资源的请求。只是......没有罐。任何地方。我清除日志,清除我的浏览器缓存,并刷新做了CTRL-R。仍然,而不是在日志提琴手一个JAR请求。

Finally, I kicked on Fiddler2, and I don't see a single request for the jar files anywhere The host site is running from my Visual Studio debugger, so it's running on localhost. But I see the requests for all the other resources on Fiddler. Just... no Jars. ANYWHERE. I clear the log, cleared my browser cache, and did a ctrl-R refresh. And still, not a single Jar request on the Fiddler log.

我甚至没有加载页面后,小程序标签的写入延迟(与JS),一旦所有的提琴手活动放缓。元素被写入到文件(我可以看到100x100的Java错误窗口),但不是的的请求,显示出来的小提琴手。

I even did a delayed write (with JS) of the applet tag after the page loaded, once all the Fiddler activity slowed down. The element gets written to the document (and I can see the 100x100 Java error window), but not a single request shows up on Fiddler.

任何建议,我走之前爬进角落哭泣中睡去?

Any suggestions, before I go crawl into the corner and cry myself to sleep?

Edit:从Java控制台,如果我打L(EL)倾销类加载器列表中,我看到的东西,看起来像这样:

From the Java console, if I hit "l" (el) to "dump classloader list", I see something that looks like this:

Live entry: key=http://localhost:55446/BaseWebSite/,http://localhost:55446/BaseWebSite/applet/myappliet.jar, http://localhost:55446/BaseWebSite/applet/applet_dependency.jar, refCount=1, threadGroup=sun.plugin2.applet.Applet2ThreadGroup[name=http://localhost:55446/BaseWebSite/-threadGroup,maxpri=4]

编辑2:小程序做了一些网络(Jabber的/ XMPP),所以我做了一个自签名的证书,看看是否有帮助。得到提示对于自签名证书 - 所以它读一些 - 但仍然无法正常工作。而且它的的显示了在Java缓存文件列表...,仍然一无所获上的提琴手。

EDIT 2: The applet does some networking (Jabber/XMPP), so I did a self-signed cert to see if that helped. Get prompted regarding the self signed cert - so it's reading something - but still doesn't work. And it is not showing up in the Java cache file list... and still nothing on Fiddler.

推荐答案

原来我的问题其实是问题的组合。我将暂时解决了一个,但因为没有工作(因为有其他的问题),我会恢复,并尝试另一种方法。

It turns out my problem was actually a combination of problems. I would temporarily solve one, but since that didn't work (since there were other problems), I would revert back and try another approach.

我已经在这里尝试了许多不同的事情,我不知道的确切的修复是什么。但是,我认为它归结为是

I've tried so many different things here that I'm not sure what the exact fix was. But, I think what it boiled down to was

1)由于我的小程序使用网络组件(Jabber的/ XMPP),它需要进行签名。

1) Since my applet uses networking components (Jabber/XMPP), it needed to be signed.

2)尽管早在我的测试中,我证实,jar文件是在根封装在正确的方式,与Applet.class,后来在我调试我创建了一个南特构建脚本简化构建/签名/我部署的过程。此构建脚本是从包装工作目录罐子,这是的的应用程序的根目录。因此,AppletClient.class是不是在根了,但嵌套在断绝子目录。

2) Even though early on in my testing I confirmed that the jar file was packaged in the correct fashion, with the Applet.class at the root, later on in my debugging I created a NAnt build script for simplifying the build/sign/deploy process for me. This build script was packaging the jar from a working directory that was not the root of the application. So, the AppletClient.class was not at the root anymore, but nested in sever subdirectories.

这篇关于Java小程序的部署,ClassNotFoundException的(初级班)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆