1 Reply Latest reply on Jul 1, 2008 9:27 AM by Roberto Dondi

    "The result set is closed." error on SQL Server

    Roberto Dondi Newbie

      I have a problem with my application running in jboss 4.2.2. I recive randomly the following error:

      java.sql.SQLException: The result set is closed.
       at org.jboss.resource.adapter.jdbc.WrappedResultSet.checkState(WrappedResultSet.java:1939)
       at org.jboss.resource.adapter.jdbc.WrappedResultSet.next(WrappedResultSet.java:1181)

      while processing a resultset in a stateless session bean. The bean is invoked by a web layer not directly, but through a session facade. I can reproduce this error running a test application made with Selenium. This test case reproduce several time the same user navigation flow. The test case uses few stateless session bean: everyone makes a query to the db using stored procedures. The error occurs not in the same piece of code everytime, but in different db call. Every call to ejb layer is synchronized. I check that every connections is closed after the use.
      Checking the connection pool i verified that only one connection is used.
      Follows the datasource definition.

       <!-- sql to call when connection is created
       <new-connection-sql>some arbitrary sql</new-connection-sql>
       <!-- sql to call on an existing pooled connection when it is obtained from pool
       <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
       <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
       <type-mapping>MS SQLSERVER2000</type-mapping>

      This error occurs using also Sql Server 2005.

      Any suggestions?