Erro: java.sql.SQLException: Operation not allowed after ResultSet closed

Boa noite a todos, meu problema é o seguinte:

Conectado
java.sql.SQLException: Operation not allowed after ResultSet closed
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
at com.mysql.jdbc.ResultSetImpl.checkClosed(ResultSetImpl.java:794)
at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:7139)
at br.com.Projeto.Dao.TimeDAO.recuperarTimes(TimeDAO.java:86)
at br.com.Projeto.servlet.InsereValores.doGet(InsereValores.java:22)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)

alguém poderia da uma idéia?

aí o código[code]public List recuperarTimes() throws SQLException{
String sql = " SELECT * FROM time";

	 PreparedStatement stm = conexao.prepareStatement(sql);
	 
	 ResultSet rs = stm.executeQuery();
	 
	 List<Time> times = new ArrayList<Time>();
	 while (rs.next()) {
		Time t = new Time();
		t.setId(rs.getLong("id_time"));
		t.setCdRegistro(rs.getString("codigo_registro"));
		t.setNome(rs.getString("nome_time"));
		
		Calendar data = Calendar.getInstance();
		data.setTime(rs.getDate("data_fundacao"));
		
		t.setDtFundacao(data);
		times.add(t);
		
		rs.close();
		stm.close();
		conexao.close();
	}
	 
	return times;
 }

}[/code]

parece q tenta fazer uma nova listagem mas a conexão esta fechada, ñ sei muito bem, pesquisei sobre este problema, mas ñ entendi muito bem.
[Resolvido]

Este refere-se ao seu ResultSet que está sendo fechado

Faça o seguinte
Código Atual:

while (rs.next()) {  
           ...
           ...
            rs.close();  
            stm.close();  
            conexao.close();  
        } 

Retire essas chamadas de fechamento dentro do seu while.
forma correta:

public List&lt;Time&gt; recuperarTimes() throws SQLException{  
         String sql = " SELECT * FROM time";  
           
         PreparedStatement stm = conexao.prepareStatement(sql);  
           
         ResultSet rs = stm.executeQuery();  
           
         List&lt;Time&gt; times = new ArrayList&lt;Time&gt;();  
         while (rs.next()) {  
            Time t = new Time();  
            t.setId(rs.getLong("id_time"));  
            t.setCdRegistro(rs.getString("codigo_registro"));  
            t.setNome(rs.getString("nome_time"));  
              
            Calendar data = Calendar.getInstance();  
            data.setTime(rs.getDate("data_fundacao"));  
              
            t.setDtFundacao(data);  
            times.add(t);  
        }  
        rs.close();  
        stm.close();  
        conexao.close();  
           
        return times;  
     }  

}

[quote=jweibe]Este refere-se ao seu ResultSet que está sendo fechado

Faça o seguinte
Código Atual:

while (rs.next()) {  
           ...
           ...
            rs.close();  
            stm.close();  
            conexao.close();  
        } 

Retire essas chamadas de fechamento dentro do seu while.
forma correta:

public List&lt;Time&gt; recuperarTimes() throws SQLException{  
         String sql = " SELECT * FROM time";  
           
         PreparedStatement stm = conexao.prepareStatement(sql);  
           
         ResultSet rs = stm.executeQuery();  
           
         List&lt;Time&gt; times = new ArrayList&lt;Time&gt;();  
         while (rs.next()) {  
            Time t = new Time();  
            t.setId(rs.getLong("id_time"));  
            t.setCdRegistro(rs.getString("codigo_registro"));  
            t.setNome(rs.getString("nome_time"));  
              
            Calendar data = Calendar.getInstance();  
            data.setTime(rs.getDate("data_fundacao"));  
              
            t.setDtFundacao(data);  
            times.add(t);  
        }  
        rs.close();  
        stm.close();  
        conexao.close();  
           
        return times;  
     }  

}

[/quote]

rapaz deu certo, erro de principiante. Pode crê muito obrigado

se o problema foi solucionado, edite a primeira mensagem do tópico e coloque no assunto [RESOLVIDO]

di boa