JDK-6762450 : NoClassDefFoundError gives no indication why a class could not loaded.
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 6
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2008-10-22
  • Updated: 2011-02-16
  • Resolved: 2010-08-31
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b22, mixed mode)

FULL OS VERSION :
Linux 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
If an IOException occurs loading a class, class loading fails, but no indication is given as to why.  The ClassLoader however does given a reason (see findClass) but this is discarded or this logic is not used.

java.lang.NoClassDefFoundError: {class-not-loaded}

This can mean the file was not deployed, or you have reached your open file limit, or I guess a host of other reasons.

THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes

THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a program which opens enough files/sockets to reach the open files limit.
When an error occurs, pass this error to an instance of a class which has not been loaded before. :-|

EXPECTED VERSUS ACTUAL BEHAVIOR :
Ideally the opne files limit shouldn't prevent classes loading.
However, it it does, it should report this is the reason the class could not be loaded.  In fact I don't see why it doesn't do this always, even FileNotFoundException is a good hint.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NoClassDefFoundError: {class-not-loaded}

REPRODUCIBILITY :
This bug can be reproduced always.