Re: java.lang.NullPointerException msg after upgrade - Mailing list pgsql-jdbc
From | Nick Fankhauser |
---|---|
Subject | Re: java.lang.NullPointerException msg after upgrade |
Date | |
Msg-id | NEBBLAAHGLEEPCGOBHDGIEKIHGAA.nickf@ontko.com Whole thread Raw |
In response to | java.lang.NullPointerException msg after upgrade (Olivier BULLAT <Olivier.Bullat@ifma.fr>) |
List | 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@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Olivier BULLAT Sent: Thursday, May 15, 2003 2:19 AM To: pgsql-jdbc@postgresql.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.Bullat@ifma.fr http://www.ifma.fr --------------------------------------------------------------------------
pgsql-jdbc by date: