0 Replies Latest reply on Feb 3, 2012 2:29 AM by ye li

    jboss AS connection can not be disused when F5 loadbalance switch,is jboss bug ?

    ye li Newbie

      env: jboss5 - F5 - mysql

      when F5 switch to standby, jboss5 app server wil not reconnection to mysql,jdbc connection in jboss pool is unuseful,

      exception is

       

       

      {code}

      Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Connection.close() has already been called. Invalid operation in this state.

      {code}

       

       

      we found the connection jboos wrapped is not close, in org.jboss.resource.adapter.jdbc.WrappedConnection

       

      {code}

      public PreparedStatement prepareStatement(String sql) throws SQLException

         {

            lock();

            try

            {

      //it will set autocommit, but when F5 switch, the jdbc connection will be unuseful, checkTransaction() will throw exception ,

      //but jboss connection pool did not disuse  the connection jboss wrappered ! why ?

               checkTransaction();

               try

               {

                 //if  move "checkTransaction(); "  there , connection will be disused

       

       

                  return wrapPreparedStatement(mc.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY));

               }

               catch (Throwable t)

               {

       

       

      //disuse connection

                  throw checkException(t);

               }

            }

            finally

            {

               unlock();

            }

         }

      {code}

       

      at jboss 4x 5x 6 x, the logic is same, why checkTransaction() not check “Communications link failure” Exception and disused it ?