0 Replies Latest reply on Sep 13, 2009 12:24 AM by kegang liu

    Connection handle has been closed and is unusable

    kegang liu Newbie

      i am using jboss4.0.5. recently , the log comes up such error frequently:
      connection handle has been closed and is unusable query.
      i have checked my code and correct one error which have not closed the connection,but after that ,the error still going on.
      can anybody help me, thank you very much!

      private static DataSource ds;
      static {
      readJRunOracleDSInfo();


      Context initContext = new InitialContext();
      Context envContext = (Context)initContext.lookup("java:/comp/env");
      ds = (DataSource)envContext.lookup("IBASDB");

      }
      } else {
      try {
      Class.forName(jdbcDriver);
      } catch (Exception exp) {
      logger.error(exp);
      }
      }
      }

      public Connection getConnection() throws SQLException {
      logger.debug(">>>getConnection()");

      if (dbConn == null) {
      try {
      dbConn = newConnection();
      } catch (Exception e) {
      logger.error(e);
      e.printStackTrace();
      //throw e;
      }
      }

      logger.debug("<<<getConnection()");
      return dbConn;
      }


      public Connection newConnection() throws SQLException {
      Connection conn = null;
      if (jdbcDriver != null) {
      try {
      conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPass);

      } catch (Exception exp) {
      logger.error(exp);
      }
      } else {
      conn = ds.getConnection();

      }

      return conn;
      }

      public void closeConnection() throws SQLException {
      logger.debug(">>>closeConnection()");
      if (!transactionStarted) {
      try {
      DbUtils.close(dbConn);

      } catch (SQLException e) {
      logger.error(e);
      throw e;
      }
      dbConn = null;
      }

      }


      10:28:46,983 ERROR [DbHelper] java.sql.SQLException: Connection handle has been closed and is unusable Query: qpay_budget_maintain_pck.prc_check_button_status Parameters: [1493, 23991, 96, 30]
      10:28:46,983 DEBUG [Session] >>>closeConnection()
      10:28:46,983 DEBUG [Session] <<<closeConnection()
      10:28:46,983 ERROR [STDERR] java.sql.SQLException: Connection handle has been closed and is unusable Query: qpay_budget_maintain_pck.prc_check_button_status Parameters: [1493, 23991, 96, 30]
      10:28:46,983 ERROR [STDERR] at com.pccw.commons.database.BaseCaller.rethrow(BaseCaller.java(Compiled Code))
      10:28:46,983 ERROR [STDERR] at com.pccw.commons.database.ProcCaller.query(ProcCaller.java(Compiled Code))
      10:28:46,983 ERROR [STDERR] at com.pccw.commons.database.BaseCaller.query(BaseCaller.java(Inlined Compiled Code))
      10:28:46,983 ERROR [STDERR] at com.pccw.commons.database.DbHelper.runProcQuery(DbHelper.java(Compiled Code))
      10:28:46,983 ERROR [STDERR] at com.pccw.payroll.global.common.impl.ButtonDAOImpl.checkButtonAvailable(ButtonDAOImpl.java:64)
      10:28:46,983 ERROR [STDERR] at com.pccw.payroll.global.common.action.ButtonAction.checkButtonAvailable(ButtonAction.java:93)
      10:28:46,983 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor219.invoke(Unknown Source)
      10:28:46,983 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
      10:28:46,983 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
      10:28:46,983 ERROR [STDERR] at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
      10:28:46,983 ERROR [STDERR] at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
      10:28:46,983 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
      10:28:46,983 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
      10:28:46,983 ERROR [STDERR] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
      10:28:46,983 ERROR [STDERR] at com.pccw.eHR.workflow.WorkflowActionServlet.process(WorkflowActionServlet.java:15)
      10:28:46,983 ERROR [STDERR] at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
      10:28:46,983 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at com.pccw.hades.framework.filter.LoginFilter.doFilter(LoginFilter.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at com.pccw.hades.framework.filter.DynamicPasswordFilter.doFilter(DynamicPasswordFilter.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java(Compiled Code))
      10:28:46,984 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      10:28:46,984 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      10:28:46,984 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      10:28:46,984 ERROR [STDERR] at java.lang.Thread.run(Thread.java:570)