简体   繁体   English

applet无法从jar加载类

[英]applet fails to load class from jar

Some users are complaining that the applet no longer works, When they view the java console they are greeted with a java.lang.noClassDefFoundError and checking my access log's I see they have downloaded the jar file that contains the class, and then issue a get request for the particular class. 有些用户抱怨applet不再有效,当他们查看java控制台时会遇到java.lang.noClassDefFoundError并检查我的访问日志,我看到他们已经下载了包含该类的jar文件,然后发出了get请求特定的课程。

Different users break on different classes. 不同的用户打破不同的类。

Some users are fine. 有些用户很好。

Any ideas what could cause this/fix this. 任何想法可能导致这个/解决这个问题。

I have checked to make sure the file is in their java cache, cleared the cache etc. nothing seems to fix them. 我已经检查过以确保文件在他们的java缓存中,清除了缓存等。似乎没有什么能解决它们。

If they hit a qa site it breaks as well. 如果他们遇到qa网站,它也会破坏。

The jar is getting corrupted in transit, We are looking at getting patches from oracle/bea for the server. jar正在传输中被破坏,我们正在寻找从服务器的oracle / bea获取补丁。

It appears that if a connection is too slow (Modem speeds) that weblogic will signal the end of a transfer by sending a packet with len=0. 看来,如果连接太慢(调制解调器速度),weblogic将通过发送len = 0的数据包来指示传输结束。

The network will signal java saying the download completed successfully and then java fails with a java.lang.noClassDefFoundError. 网络将通知java表示下载已成功完成,然后java失败并出现java.lang.noClassDefFoundError。

This can occur if the class itself can be loaded but some dependency of that class cannot be. 如果可以加载类本身但是该类的某些依赖性不能,则会发生这种情况。 Are there external JARs that are dependencies? 是否有依赖的外部JAR?

Are you sure the jar file contains all the necessary classes? 你确定jar文件包含所有必要的类吗? Open it up in your favorite Zip application and double check. 在您喜欢的Zip应用程序中打开它并仔细检查。 Maybe a recent build of that jar got messed up and doesn't have everything in it. 也许这个罐子的最近版本搞砸了并且没有其中的所有内容。

I'm assuming that you have made some updates by your wording. 我假设你的措辞已经做了一些更新。 It is highly likely that some users have a previous Jar file cached. 某些用户很可能已缓存了之前的Jar文件。

When deploying a new applet version in a live configuration I perform the following: 在实时配置中部署新的applet版本时,我执行以下操作:

  1. Ensure the page holding the applet is not cached - use HTTP no-caching techniques . 确保不缓存包含applet的页面 - 使用HTTP no-caching技术 You may want to redeploy from a new page with these headers to ensure that it's not the case. 您可能希望从包含这些标头的新页面重新部署,以确保不是这种情况。
  2. Deploy the jar file from a different URL for each update (I encode the version number in a directory, but you can equally rename the jar file). 为每次更新从不同的URL部署jar文件(我在目录中编码版本号,但您可以同样重命名jar文件)。
  3. If applet performs any client server interaction ensure that you check version numbers and report incorrect version to the user. 如果applet执行任何客户端服务器交互,请确保检查版本号并向用户报告不正确的版本。

Even if you follow this the user may still have a problem, ask them to try these one at a time (listed in order they should try): 即使您遵循此操作,用户可能仍然遇到问题,请他们一次尝试这些问题(按照他们应该尝试的顺序列出):

  1. Press refresh on the browser window. 按浏览器窗口上的刷新。
  2. Restart all browser windows 重启所有浏览器窗口
  3. Uninstall all Java VMs found on "Add/Remove programmes" and reinstall latest Java (yes, they must do this at their own risk!) 卸载“添加/删除程序”中找到的所有 Java VM并重新安装最新的Java(是的,他们必须自行承担风险!)

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

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