3 Replies Latest reply on Oct 7, 2003 3:05 AM by berni

    Closing a statement you left open

    berni Newbie

      With a stateful session bean, after making a query (SELECT ...) with a first method, I obtain this message "Closing a statement you left open, please do your own housekeeping".
      After that, I can't access to the resultset with another method from the same session bean because the connection has been closed.
      Why has Jboss closed the connection between the two method calls ?

      Please, help

      PS : I use jboss-3.2.1_tomcat-4.1.24.
      And I think my java code is ok, because if I used the resultset directly with the first method, there is no problem.

        • 1. Re: Closing a statement you left open
          Jon Barnett Master

          It depends on what you are doing between method calls. However, it would appear that you are not using the same session. It is difficult to guess because we don't have enough understanding of what you are doing between the calls.

          • 2. Re: Closing a statement you left open
            Jon Barnett Master

            Also, have you verified that it is a statefull session bean? Check the logs just to make sure as the only other reason you are having the problem is that the EJB is not stateful but stateless.

            • 3. Re: Closing a statement you left open
              berni Newbie

              In my ejb-jar.xml I have this two lines :
              <session-type>Stateful</session-type>
              <transaction-type>Container</transaction-type>
              (and the dtd is : <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>)

              In the log, there are this lines :
              09:25:56,796 INFO [EjbModule] Starting
              09:25:56,796 INFO [StatefulSessionContainer] Starting
              09:25:56,812 INFO [StatefulSessionInstancePool] Starting
              09:25:56,812 INFO [StatefulSessionInstancePool] Started
              09:25:56,812 INFO [StatefulSessionFilePersistenceManager] Starting
              09:25:56,828 INFO [StatefulSessionFilePersistenceManager] Started
              09:25:56,828 INFO [StatefulSessionContainer] Started
              09:25:56,828 INFO [EjbModule] Started
              09:25:56,828 INFO [EJBDeployer] Deployed: file:/C:/JBoss/jboss-3.2.1_tomcat-4.1
              .24/server/default/tmp/deploy/server/default/deploy/services_jboss.ear/40.
              services_jboss.ear-contents/tools_SourceData.jar

              And in the jmx-console, the session bean appears in a "StatefulSessionContainer".

              In the java code, between the two calls (executeQuery() in the first one and resultset.next() in the second one),
              I just check a boolean parameter for using differently the resultset.

              As I said in my first message, in this case, it would be possible to change the code to execute the
              executeQuery() and the resultset.next() int the same call, but the application is working well under another J2EE server, so why not under JBoss ?