Error in webservice: javax.servlet.ServletException: java.lang.NullPointerException

0

I'm trying to run a query in my Webservice, but the function that the query is inside breaks nothing.

My code:

public boolean excluir(String usuario)
{
    String sql = "DELETE * FROM listaproduto where uclogin=?";
    Boolean retorno = false;
    PreparedStatement pst = Conexao.getPreparedStatement(sql);
    try {
        pst.setString(1, usuario); //Ele quebra nessa parte.
        if(pst.executeUpdate()>0)
        {
            retorno = true;
        }
    } catch (SQLException ex) {
        Logger.getLogger(ProdutoDAO.class.getName()).log(Level.SEVERE, null, ex);
        retorno = false;
    }
    return retorno;
} 

Error:

  

GET RequestFailed RequestFailed - > Status: (500) Answer: {HTTP   Status 500 - Internal Server Error

     

type Exception report

     

messageInternal Server Error

     

descriptionThe server encountered an internal error that prevented it   from fulfilling this request.

     

exception

     

javax.servlet.ServletException: java.lang.NullPointerException

     

root cause

     

java.lang.NullPointerException

     

note The full stack traces of the exception and its root causes are   available in the GlassFish Server Open Source Edition 4.1.1 logs.   GlassFish Server Open Source Edition 4.1.1

     

}

    
asked by anonymous 27.09.2017 / 19:43

0 answers