简体   繁体   中英

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.

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.

If they hit a qa site it breaks as well.

The jar is getting corrupted in transit, We are looking at getting patches from oracle/bea for the server.

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.

The network will signal java saying the download completed successfully and then java fails with a 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?

Are you sure the jar file contains all the necessary classes? Open it up in your favorite Zip application and double check. 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.

When deploying a new applet version in a live configuration I perform the following:

  1. Ensure the page holding the applet is not cached - use HTTP no-caching techniques . 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).
  3. If applet performs any client server interaction ensure that you check version numbers and report incorrect version to the user.

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!)

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