From: | "Nick Fankhauser" <nickf(at)ontko(dot)com> |
---|---|
To: | "Olivier BULLAT" <Olivier(dot)Bullat(at)ifma(dot)fr>, <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: java.lang.NullPointerException msg after upgrade |
Date: | 2003-05-15 14:07:21 |
Message-ID: | NEBBLAAHGLEEPCGOBHDGIEKIHGAA.nickf@ontko.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Olivier-
Are you sure that the problem is with the connection? I'd suggest inserting
this line before opening the connection to make sure the session values
exist in this environment:
System.err.println(" URL: "+variables_trombi.url_base+
" nom: "+session.getValue("nom")+
" passe: "+session.getValue("passe"));
Regards,
-Nick
-----Original Message-----
From: pgsql-jdbc-owner(at)postgresql(dot)org
[mailto:pgsql-jdbc-owner(at)postgresql(dot)org]On Behalf Of Olivier BULLAT
Sent: Thursday, May 15, 2003 2:19 AM
To: pgsql-jdbc(at)postgresql(dot)org
Subject: [JDBC] java.lang.NullPointerException msg after upgrade
Hello,
With some programs which are OK, we upgrade our version of soft:
Now, we use Apache, Posgresql 7.2, servlet java (JDK 1.2), Jserv and
jdbc7.2dev-1.2.jar.
Log gives a message "java.lang.NullPointerException" on instruction
con = DriverManager.getConnection(jdbc:postgresql://127.0.0.1:5432/menu,
session.getValue("nom") + "", session.getValue("passe") + "")
The name of JDBC Driver has been changed in java source (msg ClassNotFound):
before: Class.forName("postgresql.Driver");
now: Class.forName("org.postgresql.Driver");
Example:
try {
System.err.println("ChoixRecherche.java: Avant ouverture driver");
try {
// Modif OBULLAT 13/05/03
// Class.forName("postgresql.Driver");
Class.forName("org.postgresql.Driver"); //on charge le driver postgresql
} catch (ClassNotFoundException cnfe) {
System.err.println("Programme ChoixRecherche.java: Couldn't find driver
class:");
cnfe.printStackTrace();
}
System.err.println("ChoixRecherche.java: Aprés ouverture driver");
System.err.println("Programme ChoixRecherche.java: variables_menu.url_base "
+ variables_menu.url_base);
con =
DriverManager.getConnection(variables_trombi.url_base,session.getValue("nom"
)+"",session.getValue("passe")+"");
System.err.println("ChoixRecherche.java: Aprés con =
DriverManager.getConnection");
stmt = con.createStatement();
System.err.println("ChoixRecherche.java: Aprés stmt =
con.createStatement()");
choix(stmt, out);
System.err.println("ChoixRecherche.java: Aprés choix(stmt,out)");
stmt.close();
con.close();
}
catch (SQLException ex) {
while (ex != null) {
out.println("<SQLEXCEPTION> "+ ex);
System.err.println("Programme ChoixRecherche.java: SQLEXCEPTION "+ ex);
ex = ex.getNextException();
}
}
catch (java.lang.Exception ex) {
ex.printStackTrace();
out.println("<JAVALANGEXEPTION>"+ ex);
System.err.println("ChoixRecherche.java: JAVALANGEXCEPTION "+ ex);
}
}
log are:
ChoixRecherche.java: Avant ouverture driver
ChoixRecherche.java: Aprés ouverture driver
Programme ChoixRecherche.java: variables_menu.url_base
jdbc:postgresql://127.0.0.1:7654/menu
java.lang.NullPointerException:
at ChoixRecherche.service(ChoixRecherche.java:40)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jservssi.ServletInfoRequest.runServlet(JServSSI.java:917)
at org.apache.jservssi.JServSSI.interpretPage(JServSSI.java:366)
at org.apache.jservssi.JServSSI.doGet(JServSSI.java:302)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:499)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java:317)
at org.apache.jserv.JServConnection.run(JServConnection.java:188)
at java.lang.Thread.run(Thread.java:479)
ChoixRecherche.java: JAVALANGEXCEPTION java.lang.NullPointerException:
Any idea ?
--------------------------------------------------------------------------
Olivier BULLAT
Responsable du Centre de Ressources Informatiques
Institut Francais de Mecanique Avancee - IFMA
Campus de CLERMONT-FERRAND / Les Cezeaux
BP 265
63175 AUBIERE Cedex
Tel: 04.73.28.80.35
Fax: 04.73.28.81.00
mail: Olivier(dot)Bullat(at)ifma(dot)fr
http://www.ifma.fr
--------------------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Antonio Calero | 2003-05-15 14:56:13 | Connections performance is reduced |
Previous Message | Olivier BULLAT | 2003-05-15 07:18:59 | java.lang.NullPointerException msg after upgrade |