Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 6299B6330C2 for ; Wed, 18 Mar 2009 06:21:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 99025-09 for ; Wed, 18 Mar 2009 06:20:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tremor.opencloud.co.nz (tremor.opencloud.co.nz [131.203.101.230]) by mail.postgresql.org (Postfix) with ESMTP id 387896328CC for ; Wed, 18 Mar 2009 06:21:00 -0300 (ADT) Received: from 219-89-102-160.jetstart.xtra.co.nz ([219.89.102.160] helo=[192.168.1.3]) by tremor.opencloud.co.nz with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1LjrxE-0008EC-Ga; Wed, 18 Mar 2009 22:20:52 +1300 Message-ID: <49C0BCF4.6020609@opencloud.com> Date: Wed, 18 Mar 2009 22:20:52 +1300 From: Oliver Jowett User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Robin Rosenberg CC: pgsql-jdbc@postgresql.org Subject: Re: NoClassDefFoundErrors References: <200903180901.41694.robin.rosenberg.lists@dewire.com> <49C0B4C4.1070708@opencloud.com> <200903180959.48234.robin.rosenberg.lists@dewire.com> In-Reply-To: <200903180959.48234.robin.rosenberg.lists@dewire.com> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200903/94 X-Sequence-Number: 19424 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