Hello, Sorry if I don't post at the right place but I'm sending you this mail to make a bug (I think that is one) report. I'm developping a servlet and a mistake made Tomcat stopping each time my code had to be executed. An exception was thrown before and here is the extract of Tomcat log file: java.sql.SQLException: No operations allowed after statement closed There was, indeed, an error in my code and I used a preparedStatement I had already closed but is it normal that Tomcat stopped?
Here is my source code: ---------------------------------------------------------------------- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setStatus( HttpServletResponse.SC_OK ); response.setContentType( "text/vnd.wap.wml" ); ServletOutputStream out = response.getOutputStream(); int code_id = Integer.parseInt(request.getParameter("code_id")); out.println("<?xml version=\"1.0\"?>"); out.println("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \" <BLOCKED::http://www.wapforum.org/DTD/wml_1.1.xml\> http://www.wapforum.org/DTD/wml_1.1.xml\">"); try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); java.sql.Connection conn = java.sql.DriverManager.getConnection( "jdbc:mysql://localhost/bd?user=user&password=password"); String useragent = request.getHeader("User-Agent"); PreparedStatement stmt = conn.prepareStatement("SELECT DISTINCT nom1_id, nom1, nom2 FROM device NATURAL JOIN nom1 INNER JOIN nom2 ON nom2.nom2_id = nom1.nom2_id WHERE phone_user_agent = ?"); stmt.setString(1, useragent); ResultSet rs = stmt.executeQuery(); String nom1 = ""; String nom2= ""; while (rs.next()) { nom1 = rs.getString("nom1"); nom2 = rs.getString("nom2"); } stmt.close(); PreparedStatement stmt_jeucode = conn.prepareStatement("SELECT code FROM codes WHERE code_id = ?"); stmt_jeucode.setInt(1, code_id); rs = stmt.executeQuery(); // Exception levée ici String code = ""; while (rs.next()) { code = rs.getString("code"); } String toPrint = "gal" + code_id + "_" + code + "_" + nom2 + "_" + nom1 + ".jar"; out.println("<wml><card id=\"toto\" title=\"doPost\"><p>" + toPrint + " doPost</p></card></wml>"); } catch(Exception e){ System.err.println("Connection ratée: "+e); System.exit(-1); } out.close(); } ---------------------------------------------------------------------- Best Regards, Dimitri Piriou Axellance, France