Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4228099

Can java.lang.NoClassDefFoundError contain information?

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description


      Name: dbT83986 Date: 04/08/99


      Could NoClassDefFoundError contain some information
      in it like [a] what class wasn't found and [b] the
      "reason" (esp if out of file descriptors).

      See the following 2 recent bug reports:

      == update edit ==
      https://bugs.openjdk.java.net/browse/JDK-4027749
      https://bugs.openjdk.java.net/browse/JDK-4206406

      more issues logged in the past with the NoClassDefFoundError label also :
      https://bugs.openjdk.java.net/issues/?jql=labels%20%3D%20NoClassDefFoundError
      == end update edit ==

      It is kinda hard to debug things when you get a
      "spurious" NoClassDefFoundError if the Error has no
      information in it - for *years* I thought this was
      just a "JIT bug" but now w/ JDK-4027749 the out of fds
      thing makes sense.

      So I suggest at the very least making the msg in the
      Error contain the fully qualified class name and
      the reason, where let's say the reason is "just not found"
      or "out of fds".

      There is a more general issue (philosophy) with all
      the exceptions/errors/throwables in the JDK in that they
      typically contain no information other than their class name.
      In our s/w dev we put in a few bits of info to allow
      problems to be diagnosed.
      (Review ID: 56741)
      ======================================================================

      Name: dbT83986 Date: 04/13/99


      NoClassDefFoundError is used too loosely.

      For instance, when you go to create a new instance of a class,
      and the VM can not find one of the classes in it's search path,
      it throws this error with the class that was not found as the
      detailed message.

      It is also used when you say Class.forName("AClass") when you
      should have used Class.forName("some_package.AClass"). The
      detailed message says (wrong name: some_package/AClass).

      The latter problem is very different from the first problem,
      but I can't tell the difference between them without parsing
      the detailed message (which could probably change from one VM
      implementation to another).

      So, please provide more subclasses of NoClassDefFoundError.

      While your at it, could you provide a method that returns the
      class name that was not found? Again, that would keep me from
      having to parse the detailed message for the answer that could
      so easily be provided.

      Thanks and keep up the outstanding work,
      Michael
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                dblairsunw Dave Blair (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: