6 Replies Latest reply on Sep 21, 2006 4:29 PM by pr_fi

    JBoss-4.0.4-GA and Hibernate-3.1.3

    shanr

      I am using Jboss-404-GA appliocation server and hibernate-3.1.3 for my appliction.

      When closing the resultset getting the following exception

      [12:34:55] - java.sql.SQLException: Already closed
      [12:34:55] - at org.jboss.resource.adapter.jdbc.WrappedResultSet.close(Wrappe
      dResultSet.java:178)

      The code snipet:
      The line, where getting exception is marked in Red

      public static void relaseDBResources(Statement stmt, ResultSet rs) {
      try {
      if (stmt != null) {
      stmt.close();
      }

      if (rs != null) {
      rs.close();
      }
      } catch (SQLException sqle) {
      sqle.printStackTrace();
      }
      }

      The same code woking perfectly with Jboss-402.

      Can anyone help me in this regard. ?
      Thanks in advance!!.

        • 1. Re: JBoss-4.0.4-GA and Hibernate-3.1.3

          I am also having a similar issue wih the same environment and as ShanR said it worked on JBoss 4.0.0 and Hibernate 2.0 earlier.

          We use WebDav for the files section, and when I try to upload a file, this SQL exception Already closed comes up.

          INFO [STDOUT] org.apache.slide.store.impl.rdbms.StandardRDBMSAdapter - WARNING - java.sql.SQLException: Already closed

          ERROR [STDERR] java.sql.SQLException: Already closed at org.jboss.resource.adapter.jdbc.WrappedResultSet.close(WrappedResultSet.java:178)
          ERROR [STDERR] at org.apache.slide.store.impl.rdbms.StandardRDBMSAdapter.close(StandardRDBMSAdapter.java:1383)
          ERROR [STDERR] at org.apache.slide.store.impl.rdbms.StandardRDBMSAdapter.createRevisionDescriptors(StandardRDBMSAdapter.java:976)

          Any suggestions please.

          • 2. Re: JBoss-4.0.4-GA and Hibernate-3.1.3
            nabeelhamad

            We also had the exact problem.

            In a particular part of our code first we close the Statement and then we close the resultSet. In the line where we close the result set the 'Already Closed' exception is thrown.

            We tested the same on JBoss4.0.3 and is working fine.

            • 3. Re: JBoss-4.0.4-GA and Hibernate-3.1.3

              I found a soultion for my issue, since it was the exception from the apache.slide end, I have commented the closing part of statement and result set on the apache classes, so that Jboss can take care of it on this side.

              So that fixed the exception being thrown on the console.

              And coming to the previous question, I think the order matters, if a Statment is closed automatically the ResultSet is closed as it is associated with the Statement.

              So if you really want to make sure all to be closed, make sure you close the ResultSet first and then Statement and finally the Connection.

              Please let me know if this helps.

              • 4. Re: JBoss-4.0.4-GA and Hibernate-3.1.3
                ssgemail

                try it as following:

                if (rs != null){
                rs.close();
                }

                if (stmt != null){
                stmt.close();
                }

                • 5. Re: JBoss-4.0.4-GA and Hibernate-3.1.3
                  pr_fi
                  • 6. Re: JBoss-4.0.4-GA and Hibernate-3.1.3
                    pr_fi

                     

                    "pr_fi" wrote:
                    http://www.jboss.com/index.html?module=bb&op=viewtopic&t=86912


                    Apologies for above post. Request to moderator: please delete. Both.