Re: Exception Error - Please help I've tried everything!

From: "Greg Peters" <gregpeters79(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Exception Error - Please help I've tried everything!
Date: 2006-11-27 08:43:24
Message-ID: 9bc001470611270043p36c00a1eu89754a46e26c58f3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

OK. This is driving me crazy. I have the postgresql.jar file in the same
directory. This is my directory listing:

C:\Documents and Settings\java\GregScratch\src>dir
Volume in drive C has no label.
Volume Serial Number is B468-3FBB

Directory of C:\Documents and Settings\java\GregScratch\src

27/11/2006 06:25 PM <DIR> .
27/11/2006 06:25 PM <DIR> ..
26/11/2006 10:36 PM 726 CheckString.java
24/11/2006 11:51 PM 140 helloworldapp.java
26/11/2006 05:11 PM 402,906 postgresql.jar
27/11/2006 06:25 PM 1,179 PostgresqlClient.class
27/11/2006 06:25 PM 545 PostgresqlClient.java
26/11/2006 02:49 PM 617 SetPoints.java
26/11/2006 01:44 AM 641 VolcanoApplication.java
26/11/2006 01:44 AM 432 VolcanoRobot.java
8 File(s) 407,186 bytes
2 Dir(s) 165,819,129,856 bytes free

C:\Documents and Settings\java\GregScratch\src>

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I tried running:

jar tf postgresql.jar

and got:

C:\Documents and Settings\java\GregScratch\src>jar tf postgresql.jar
META-INF/
META-INF/MANIFEST.MF
org/
org/postgresql/
org/postgresql/Driver$1.class
org/postgresql/Driver$ConnectThread.class
org/postgresql/Driver.class
org/postgresql/PGConnection.class
org/postgresql/PGNotification.class
org/postgresql/PGRefCursorResultSet.class
org/postgresql/PGResultSetMetaData.class
org/postgresql/PGStatement.class
org/postgresql/core/
org/postgresql/core/BaseConnection.class
org/postgresql/core/BaseResultSet.class
org/postgresql/core/BaseStatement.class
org/postgresql/core/ConnectionFactory.class
org/postgresql/core/Encoding.class
org/postgresql/core/Field.class
org/postgresql/core/Notification.class
org/postgresql/core/Oid.class
org/postgresql/core/PGBindException.class
org/postgresql/core/PGStream$1.class
org/postgresql/core/PGStream.class
org/postgresql/core/ParameterList.class
org/postgresql/core/ProtocolConnection.class
org/postgresql/core/Query.class
org/postgresql/core/QueryExecutor.class
org/postgresql/core/ResultCursor.class
org/postgresql/core/ResultHandler.class
org/postgresql/core/UTF8Encoding.class
org/postgresql/core/Utils.class
org/postgresql/core/types/
org/postgresql/core/types/PGBigDecimal.class
org/postgresql/core/types/PGBoolean.class
org/postgresql/core/types/PGByte.class
org/postgresql/core/types/PGDouble.class
org/postgresql/core/types/PGFloat.class
org/postgresql/core/types/PGInteger.class
org/postgresql/core/types/PGLong.class
org/postgresql/core/types/PGNumber.class
org/postgresql/core/types/PGShort.class
org/postgresql/core/types/PGString.class
org/postgresql/core/types/PGType.class
org/postgresql/core/types/PGUnknown.class
org/postgresql/core/v2/
org/postgresql/core/v2/ConnectionFactoryImpl$SimpleResultHandler.class
org/postgresql/core/v2/ConnectionFactoryImpl.class
org/postgresql/core/v2/FastpathParameterList.class
org/postgresql/core/v2/ProtocolConnectionImpl.class
org/postgresql/core/v2/QueryExecutorImpl$1.class
org/postgresql/core/v2/QueryExecutorImpl$2.class
org/postgresql/core/v2/QueryExecutorImpl$3.class
org/postgresql/core/v2/QueryExecutorImpl.class
org/postgresql/core/v2/SimpleParameterList.class
org/postgresql/core/v2/V2Query.class
org/postgresql/core/v3/
org/postgresql/core/v3/CompositeParameterList.class
org/postgresql/core/v3/CompositeQuery.class
org/postgresql/core/v3/ConnectionFactoryImpl$1.class
org/postgresql/core/v3/ConnectionFactoryImpl$UnsupportedProtocolException.class
org/postgresql/core/v3/ConnectionFactoryImpl.class
org/postgresql/core/v3/Portal.class
org/postgresql/core/v3/ProtocolConnectionImpl.class
org/postgresql/core/v3/QueryExecutorImpl$1.class
org/postgresql/core/v3/QueryExecutorImpl$2.class
org/postgresql/core/v3/QueryExecutorImpl$3.class
org/postgresql/core/v3/QueryExecutorImpl$ErrorTrackingResultHandler.class
org/postgresql/core/v3/QueryExecutorImpl.class
org/postgresql/core/v3/SimpleParameterList.class
org/postgresql/core/v3/SimpleQuery.class
org/postgresql/core/v3/V3ParameterList.class
org/postgresql/core/v3/V3Query.class
org/postgresql/ds/
org/postgresql/ds/PGConnectionPoolDataSource.class
org/postgresql/ds/PGPoolingDataSource$1.class
org/postgresql/ds/PGPoolingDataSource.class
org/postgresql/ds/PGSimpleDataSource.class
org/postgresql/ds/common/
org/postgresql/ds/common/BaseDataSource.class
org/postgresql/ds/common/PGObjectFactory.class
org/postgresql/ds/common/PooledConnectionImpl$ConnectionHandler.class
org/postgresql/ds/common/PooledConnectionImpl$StatementHandler.class
org/postgresql/ds/common/PooledConnectionImpl.class
org/postgresql/fastpath/
org/postgresql/fastpath/Fastpath.class
org/postgresql/fastpath/FastpathArg.class
org/postgresql/geometric/
org/postgresql/geometric/PGbox.class
org/postgresql/geometric/PGcircle.class
org/postgresql/geometric/PGline.class
org/postgresql/geometric/PGlseg.class
org/postgresql/geometric/PGpath.class
org/postgresql/geometric/PGpoint.class
org/postgresql/geometric/PGpolygon.class
org/postgresql/jdbc2/
org/postgresql/jdbc2/AbstractJdbc2Array.class
org/postgresql/jdbc2/AbstractJdbc2Blob.class
org/postgresql/jdbc2/AbstractJdbc2BlobClob$LOIterator.class
org/postgresql/jdbc2/AbstractJdbc2BlobClob.class
org/postgresql/jdbc2/AbstractJdbc2Clob.class
org/postgresql/jdbc2/AbstractJdbc2Connection$1.class
org/postgresql/jdbc2/AbstractJdbc2Connection$TransactionCommandHandler.class
org/postgresql/jdbc2/AbstractJdbc2Connection.class
org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.class
org/postgresql/jdbc2/AbstractJdbc2ResultSet$CursorResultHandler.class
org/postgresql/jdbc2/AbstractJdbc2ResultSet$NullObject.class
org/postgresql/jdbc2/AbstractJdbc2ResultSet$PrimaryKey.class
org/postgresql/jdbc2/AbstractJdbc2ResultSet.class
org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.class
org/postgresql/jdbc2/AbstractJdbc2Statement$BatchResultHandler.class
org/postgresql/jdbc2/AbstractJdbc2Statement$StatementResultHandler.class
org/postgresql/jdbc2/AbstractJdbc2Statement.class
org/postgresql/jdbc2/EscapedFunctions.class
org/postgresql/jdbc2/ResultWrapper.class
org/postgresql/jdbc2/TimestampUtils$1.class
org/postgresql/jdbc2/TimestampUtils$ParsedTimestamp.class
org/postgresql/jdbc2/TimestampUtils.class
org/postgresql/jdbc2/TypeInfoCache.class
org/postgresql/jdbc2/optional/
org/postgresql/jdbc2/optional/ConnectionPool.class
org/postgresql/jdbc2/optional/PoolingDataSource.class
org/postgresql/jdbc2/optional/SimpleDataSource.class
org/postgresql/jdbc3/
org/postgresql/jdbc3/AbstractJdbc3Blob.class
org/postgresql/jdbc3/AbstractJdbc3Clob.class
org/postgresql/jdbc3/AbstractJdbc3Connection.class
org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.class
org/postgresql/jdbc3/AbstractJdbc3ResultSet.class
org/postgresql/jdbc3/AbstractJdbc3Statement.class
org/postgresql/jdbc3/Jdbc3Array.class
org/postgresql/jdbc3/Jdbc3Blob.class
org/postgresql/jdbc3/Jdbc3CallableStatement.class
org/postgresql/jdbc3/Jdbc3Clob.class
org/postgresql/jdbc3/Jdbc3Connection.class
org/postgresql/jdbc3/Jdbc3ConnectionPool.class
org/postgresql/jdbc3/Jdbc3DatabaseMetaData.class
org/postgresql/jdbc3/Jdbc3PoolingDataSource.class
org/postgresql/jdbc3/Jdbc3PreparedStatement.class
org/postgresql/jdbc3/Jdbc3ResultSet.class
org/postgresql/jdbc3/Jdbc3ResultSetMetaData.class
org/postgresql/jdbc3/Jdbc3SimpleDataSource.class
org/postgresql/jdbc3/Jdbc3Statement.class
org/postgresql/jdbc3/PSQLParameterMetaData.class
org/postgresql/jdbc3/PSQLSavepoint.class
org/postgresql/largeobject/
org/postgresql/largeobject/BlobInputStream.class
org/postgresql/largeobject/BlobOutputStream.class
org/postgresql/largeobject/LargeObject.class
org/postgresql/largeobject/LargeObjectManager.class
org/postgresql/ssl/
org/postgresql/ssl/MakeSSL.class
org/postgresql/ssl/NonValidatingFactory$NonValidatingTM.class
org/postgresql/ssl/NonValidatingFactory.class
org/postgresql/ssl/WrappedFactory.class
org/postgresql/util/
org/postgresql/util/Base64.class
org/postgresql/util/GT.class
org/postgresql/util/MD5Digest.class
org/postgresql/util/PGInterval.class
org/postgresql/util/PGbytea.class
org/postgresql/util/PGmoney.class
org/postgresql/util/PGobject.class
org/postgresql/util/PGtokenizer.class
org/postgresql/util/PSQLDriverVersion.class
org/postgresql/util/PSQLException.class
org/postgresql/util/PSQLState.class
org/postgresql/util/PSQLWarning.class
org/postgresql/util/ServerErrorMessage.class
org/postgresql/util/StreamWrapper.class
org/postgresql/util/UnixCrypt.class
org/postgresql/xa/
org/postgresql/xa/PGXAConnection.class
org/postgresql/xa/PGXADataSource.class
org/postgresql/xa/PGXAException.class
org/postgresql/xa/RecoveredXid.class
org/postgresql/translation/
org/postgresql/translation/messages_cs.class
org/postgresql/translation/messages_de.class
org/postgresql/translation/messages_es.class
org/postgresql/translation/messages_fr.class
org/postgresql/translation/messages_it.class
org/postgresql/translation/messages_nl.class
org/postgresql/translation/messages_pl.class
org/postgresql/translation/messages_pt_BR.class
org/postgresql/translation/messages_ru.class
org/postgresql/translation/messages_tr.class
org/postgresql/translation/messages_zh_CN.class
org/postgresql/translation/messages_zh_TW.class

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This is PostgressqlClient.java as it currently stands:

import java.sql.*;

public class PostgresqlClient{
public static void main(String[] Arguments)
throws ClassNotFoundException, SQLException{

String driver = "org.postgresql.Driver";
String url ="jdbc:postgresql:CSG";
String user = "root";
String pwd = "password";

Class.forName(driver);

Connection con = DriverManager.getConnection(url, user, pwd);
System.err.println("Connection complete");

con.close();
}
}

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This is some of the commands I have tried and their results:

C:\Documents and Settings\java\GregScratch\src>java -cp postgresql.jar:.
PostgresqlClient.class
Exception in thread "main" java.lang.NoClassDefFoundError:
PostgresqlClient/class

C:\Documents and Settings\java\GregScratch\src>java -cp postgresql.jar:.
PostgresqlClient.class
Exception in thread "main" java.lang.NoClassDefFoundError:
PostgresqlClient/class

C:\Documents and Settings\java\GregScratch\src>java -cp postgresql.jar.
PostgresqlClient.class
Exception in thread "main" java.lang.NoClassDefFoundError:
PostgresqlClient/class

C:\Documents and Settings\java\GregScratch\src>java -cp postgresql.jar
PostgresqlClient.class
Exception in thread "main" java.lang.NoClassDefFoundError:
PostgresqlClient/class

C:\Documents and Settings\java\GregScratch\src>java -cp
postgresql.jarPostgresqlClient
Exception in thread "main" java.lang.NoClassDefFoundError: PostgresqlClient

C:\Documents and Settings\java\GregScratch\src>java -cp postgresql.jar:.
PostgresqlClient
Exception in thread "main" java.lang.NoClassDefFoundError: PostgresqlClient

C:\Documents and Settings\java\GregScratch\src>

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This is what NB says (and I think I have added the module correctly):

Exception in thread "main" java.lang.ClassNotFoundException:
org.postgresql.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at PostgresqlClient.main(PostgresqlClient.java:12)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

Any ideas????

I have tried several versions of the postgresql module from the website too.

Cheers,

Greg.

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vit Timchishin 2006-11-27 10:05:19 Re: Exception Error - Please help I've tried everything!
Previous Message Andrew Lazarus 2006-11-27 04:35:08 Re: Exception Error - Please help I've tried everything!