Обсуждение: Upgrade to Postgres 7.3.3 broke app

Поиск
Список
Период
Сортировка

Upgrade to Postgres 7.3.3 broke app

От
"Josh Trutwin"
Дата:
Hi,

I had an application running at the following URL:
http://trutwins.homeip.net:8080/links/Links that no longer works after
upgrading from 7.3.2 to 7.3.3 (built from source).  If you go to the URL
you'll see the entire exception dump, but the gist of it is:
java.lang.NoClassDefFoundError:
org/postgresql/jdbc2/AbstractJdbc2Connection

This is from a Tomcat server (binary version 4.1.24), postgres.jar is in
$CATALINA_HOME/shared/lib.  If I execute jar -tvf postgres.jar, there are
no jdbc2 classes, they are all jdbc3, which is obviously why the
application croaks.

# java -version
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)

# uname -a
Linux scully 2.4.19-4GB #1 Fri Sep 13 13:14:56 UTC 2002 i686 unknown

The application code to instantiate the connection that is throwing the
exception is:

try {
    out = response.getWriter();

    Class.forName("org.postgresql.Driver").newInstance();
    connection = DriverManager.getConnection(
           "jdbc:postgresql://localhost/links", "myUser", "myPass");

} catch (ClassNotFoundException cnfe) {
    out.println("<P>Error loading driver: " + cnfe);
} catch (InstantiationException ie) {
    out.println("<P>Error instantiating class: " + ie);
} catch (IllegalAccessException iae) {
    out.println("<P>Error Illegal Access: " + iae);
} catch (IOException ioe) {
    out.println("<P>Error I/O: " + ioe);
} catch (SQLException sqle) {
    out.println("<P>SQL State: " + sqle.getSQLState());
    out.println("<P>Error Code: " + sqle.getErrorCode());
    out.println("<P>Exception: " + sqle);
}

Any thoughts on how to fix this?  I looked through the postgres docs in
the distribution and didn't see anything related to this.  google hasn't
helped either.

Thanks,

Josh Trutwin
http://trutwins.homeip.net



Re: Upgrade to Postgres 7.3.3 broke app

От
Fernando Nasser
Дата:
Make sure you have your JAVA_HOME pointing to a 1.4.1 Java if you want a JDBC3
driver (or at least Java 1.3.1 to get a JDBC2 driver).

Make sure the old driver is nowhere in your classpath.  Make sure you haven't
added it to your jre/lib/ext directory either.

P.S.: jar files are always created so having one doesn't mean the build went OK.
  Wasn't there any messages?

Fernando

Josh Trutwin wrote:> Hi,
>
> I had an application running at the following URL:
> http://trutwins.homeip.net:8080/links/Links that no longer works after
> upgrading from 7.3.2 to 7.3.3 (built from source).  If you go to the URL
> you'll see the entire exception dump, but the gist of it is:
> java.lang.NoClassDefFoundError:
> org/postgresql/jdbc2/AbstractJdbc2Connection
>
> This is from a Tomcat server (binary version 4.1.24), postgres.jar is in
> $CATALINA_HOME/shared/lib.  If I execute jar -tvf postgres.jar, there are
> no jdbc2 classes, they are all jdbc3, which is obviously why the
> application croaks.
>
> # java -version
> java version "1.4.1_02"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
> Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
>
> # uname -a
> Linux scully 2.4.19-4GB #1 Fri Sep 13 13:14:56 UTC 2002 i686 unknown
>
> The application code to instantiate the connection that is throwing the
> exception is:
>
> try {
>     out = response.getWriter();
>
>     Class.forName("org.postgresql.Driver").newInstance();
>     connection = DriverManager.getConnection(
>            "jdbc:postgresql://localhost/links", "myUser", "myPass");
>
> } catch (ClassNotFoundException cnfe) {
>     out.println("<P>Error loading driver: " + cnfe);
> } catch (InstantiationException ie) {
>     out.println("<P>Error instantiating class: " + ie);
> } catch (IllegalAccessException iae) {
>     out.println("<P>Error Illegal Access: " + iae);
> } catch (IOException ioe) {
>     out.println("<P>Error I/O: " + ioe);
> } catch (SQLException sqle) {
>     out.println("<P>SQL State: " + sqle.getSQLState());
>     out.println("<P>Error Code: " + sqle.getErrorCode());
>     out.println("<P>Exception: " + sqle);
> }
>
> Any thoughts on how to fix this?  I looked through the postgres docs in
> the distribution and didn't see anything related to this.  google hasn't
> helped either.
>
> Thanks,
>
> Josh Trutwin
> http://trutwins.homeip.net
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>



--
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


Re: Upgrade to Postgres 7.3.3 broke app

От
"Josh Trutwin"
Дата:
> Make sure the old driver is nowhere in your classpath.  Make sure you
> haven't  added it to your jre/lib/ext directory either.

ARG!  That's exactly it.  Building again.  I even have a big note with
exclamation marks in my build instructions to set CLASSPATH to ".".

Thanks,

Josh