tags:

views:

267

answers:

3

I am running a java program that sets up a database connection to an SQL database. It works fine on Mac OS X, but when I try to run the same code on Linux, I get a Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/SQLClientInfoException.

I am using jdk-1.6.0_02 - if I unzip src.zip, it turns out that SQLClientInfoException.java is not contained therein.

Also, the API documentation shows that there are exactly two methods that use this exception, both in java.sql.Connection. However, if I look at both methods in the source code, both of them seem to throw the more general SQLException instead.

Is that a bug in my java version or am I doing something wrong?

A: 

NoClassDefFoundError: "The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found." (from the API docs).

That class seems to be part of the standard jdk distribution. Likely there is an error in your path, or something in the program is hard-coded to a path that doesn't point to the right place on Linux.

Steve B.
+1  A: 

SQLClientInfoException is new in Java 1.6 and should be present in the src.zip. I have a jdk1.6.0_03 in Windows and a jdk1.6.0_06 in Linux and the class is included in both. Try to upgrade to the latest version.

kgiannakakis
The class in question is present in jdk1.6.0_10 on Linux. Thanks.
+1  A: 

Make sure you're actually running the sun JDK and not the GCJ version that ships as standard on many linux distributions. That version is a bit outdated and prone to weird bugs like this.

Tim Howland