From: Oliver Jowett <oliver@opencloud.com>
To: Robin Rosenberg <robin.rosenberg.lists@dewire.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: NoClassDefFoundErrors
Date: Wed, 18 Mar 2009 22:20:52 +1300
Message-ID: <49C0BCF4.6020609@opencloud.com> (raw)
In-Reply-To: <200903180959.48234.robin.rosenberg.lists@dewire.com>
References: <200903180901.41694.robin.rosenberg.lists@dewire.com>
<49C0B4C4.1070708@opencloud.com>
<200903180959.48234.robin.rosenberg.lists@dewire.com>
Robin Rosenberg wrote:
> Indeed it is there. NoClassDefFoundError is ofter confused with ClassNotFoundException.
>
> NoClassDefFoundError means the class was found, but it couldn't be loaded because
> of another class was needed for the base class or interface or an exception was thrown
> in a static initializer during class loading. There might be other reasons, but those are
> the ones I know about. The problem is that these errors are very hard to debug, so I was
> hoping for a clue.
I do understand the difference between the two.
NoClassDefFoundError doesn't behave as you describe. It means, as the
name says, that the named class could not be loaded.
It's thrown as a *result* of trying to resolve the named class, perhaps
because it is named as a base class or interface during classloading of
another class, or because it's referenced by a method descriptor that
needs to be resolved (some time after classloading). In this case, the
JVM is trying to resolve a call from QueryExecutorImpl (which is loaded,
initialized, and executing) to a static method on Parser. The first time
such a method is called, the JVM attempts to load and initialize Parser
so that it can resolve the method descriptor. When it cannot find
Parser.class, a NoClassDefFoundError is thrown.
I believe the class named in the NoClassDefFoundError is always the
ultimately missing class. (So if class A exists, but initialization of A
fails because class B does not exist, then you get a
NoClassDefFoundError: B as a result of trying to resolve A)
Incidentally, exceptions in static initializers during class
initialization are reported by an ExceptionInInitializerError, *not*
NoClassDefFoundError.
I would suggest taking a hard look at how Glassfish is loading the
driver classes, sounds like it is mangling things along the way somehow.
-O
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: oliver@opencloud.com, robin.rosenberg.lists@dewire.com
Subject: Re: NoClassDefFoundErrors
In-Reply-To: <49C0BCF4.6020609@opencloud.com>
References: <200903180901.41694.robin.rosenberg.lists@dewire.com> <49C0B4C4.1070708@opencloud.com> <200903180959.48234.robin.rosenberg.lists@dewire.com> <49C0BCF4.6020609@opencloud.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox