FIX: NoClassDefFoundError When a Valid Class Definition Exists

Last reviewed: January 29, 1998
Article ID: Q177754
The information in this article applies to:
  • Microsoft Internet Explorer version 4.0 for Windows NT 4.0
  • SDK for Java, version 2.0
  • Microsoft Internet Explorer version 4.0 for Windows 95

The information in this article applies specifically to version 4.79.2252 of the Microsoft Virtual Machine for Java, which is included in the above products.

SYMPTOMS

A Java applet or program that attempts to load certain valid Java classes may fail with a NoClassDefFoundError exception.

If the applet is running inside Internet Explorer, there may be no visible symptoms, except that the applet does not run properly. If Java Logging is enabled in Internet Explorer, however, the file Javalog.txt file, created in the Java subdirectory of the Windows directory, contains a log of the exception, and a call stack. Here is a typical example of the exception:

   java.lang.NoClassDefFoundError: COM/objectspace/jgl/HashMap

CAUSE

The Microsoft Virtual Machine for Java verifies that the .class file that defines each Java class is valid before loading it. Version 4.79.2252 erroneously decides that certain .class files are not valid, and therefore, fails to load them. When it fails to find a valid definition for a class, the Virtual Machine throws a NoClassDefFoundError exception.

RESOLUTION

Download and install the current Virtual Machine from the following Web site:

   http://www.microsoft.com/java/vm/dl_vmsp2.htm

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been corrected in the Microsoft Virtual Machine for Java, version 4.79.2334.

MORE INFORMATION

One class that the Virtual Machine fails to validate is the HashMap class from ObjectSpace's JGL class library. It is possible to produce other .class files that the Virtual Machine will fail to validate using a Java compiler, including Microsoft's Visual J++ or SDK 2.0 for Java.

Steps to Reproduce Behavior

If you have JGL and SDK 2.0 for Java, the following program will exhibit this bug:

   import COM.objectspace.jgl.*;
   public class HashMapTest
   {
      public static void main (String args[])
      {
         HashMap    hm = new HashMap();
      }
   }

Version 4.79.2252 of the Virtual Machine throws a NoClassDefFoundError. Version 4.79.2334 of the Virtual Machine executes this with no errors.

REFERENCES

JGL is manufactured by ObjectSpace, Inc., a vendor independent of Microsoft; we make no warranty, implied or otherwise, regarding this product's performance or reliability.

Further information about JGL can be found at the following Web site:

   http://www.objectspace.com/jgl/

For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following page on the Microsoft Technical Support site:

   http://support.microsoft.com/support/visualj/
   http://support.microsoft.com/support/java/


Additional query words: NoClassDefFoundError

Keywords : kb3rdparty JVM
Technology : kbInetDev internet
Version : WINDOWS:2.0,4.0
Platform : WINDOWS
Issue type : kbbug
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 29, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.