where is the database connection object obtained, i.e., has the 'conn'
variable been initialized? apart from that, i would advise that you
liberally sprinkle debug statements in your code (more System.out.println,
although you'd probably be better off using something like log4j), and so
find out exactly where your code is failing.

-----Original Message-----
From: Javier Alonso [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 15, 2001 5:42 PM
To: [EMAIL PROTECTED]
Subject: Re: NullPointerException


This is the method BuscarNoticias that throws the exception


public void obtenerNoticias(String idioma) {
 Statement st;
 st=null;
 ResultSet rs;
 rs=null;
 try {
  st = conn.createStatement();
  rs = st.executeQuery("SELECT EROSKI_NOTICIAS.cod_noticia, " +
   "EROSKI_NOTICIAS.titulo, " +
   "EROSKI_NOTICIAS.entradilla, " +
   "EROSKI_NOTICIAS.texto, " +
   "EROSKI_NOTICIAS.fecha, " +
   "EROSKI_NOTICIAS.tituloeus, " +
   "EROSKI_NOTICIAS.entradillaeus, " +
   "EROSKI_NOTICIAS.textocat, " +
   "EROSKI_NOTICIAS.titulogal, " +
   "EROSKI_NOTICIAS.entradillagal, " +
   "EROSKI_NOTICIAS.textogal, " +
   "EROSKI_NOTICIAS.titulocat, " +
   "EROSKI_NOTICIAS.entradillacat, " +
   "EROSKI_NOTICIAS.textocat, " +
   "EROSKI_NOTICIAS.tituloval, " +
   "EROSKI_NOTICIAS.entradillaval, " +
   "EROSKI_NOTICIAS.textoval, " +
   "EROSKI_NOTICIAS.tituloval, " +
   "EROSKI_NOTICIAS.entradillaval, " +
   "EROSKI_NOTICIAS.textoval, " +
   "EROSKI_NOTICIAS.tituloing, " +
   "EROSKI_NOTICIAS.entradillaing, " +
   "EROSKI_NOTICIAS.textoing, " +
   "EROSKI_NOTICIAS.destacado, " +
   "EROSKI_NOTICIAS.mes, " +
   "EROSKI_NOTICIAS.anyo, " +
   "EROSKI_NOTICIAS.fechanoticia, " +
   //   "EROSKI_NOTICIAS.negocio, "+
  //Todav�a no hay columna negocio.
  "FROM EROSKI_NOTICIAS ORDER BY fechanoticia");
  //vectorNoticias = new Vector();
  while (rs.next()) {
   Noticias temp = new Noticias();
   temp=null;
   temp.setCod_noticia(rs.getFloat("cod_noticias"));
   temp.setDestacado(rs.getString("destacado"));
   temp.setEntradilla(rs.getString("entradilla"));
   temp.setEntradillaCat(rs.getString("entradillacat"));
   temp.setEntradillaEus(rs.getString("entradillaeus"));
   temp.setEntradillaGal(rs.getString("entradillagal"));
   temp.setEntradillaIng(rs.getString("entradillaing"));
   temp.setEntradillaVal(rs.getString("entradillaval"));
   temp.setFecha(rs.getString("fecha"));
   //   temp.setNegocio(rs.getString("negocio"));
   // Todav�a no tenemos columna negocio
   temp.setTexto(rs.getString("texto"));
   temp.setTextoCat(rs.getString("textocat"));
   temp.setTextoEus(rs.getString("textoeus"));
   temp.setTextoGal(rs.getString("textogal"));
   temp.setTextoVal(rs.getString("textoval"));
   temp.setTitulo(rs.getString("titulo"));
   temp.setTituloCat(rs.getString("titulocat"));
   temp.setTituloEus(rs.getString("tituloeus"));
   temp.setTituloGal(rs.getString("titulogal"));
   temp.setTituloIng(rs.getString("tituloing"));
   temp.setTituloVal(rs.getString("tituloval"));
   temp.setAnyo(rs.getString("anyo"));
   temp.setMes(rs.getString("mes"));
   //Ahora a�ado todo al vector
   vectorNoticias.addElement(temp);
  }
 } catch (SQLException sql) {
  System.out.println("Se ha producido un error SQL");
  System.out.println(sql.getMessage());
 } finally {
  if (st != null) {
   try {
    st.close();
   } catch (SQLException e) {
    System.out.println("Se ha producido un error al cerrar la conexion");
    System.out.println(e.getMessage());
   }
  }
 }
}


        Javier

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to