10 Replies Latest reply on Sep 21, 2006 8:07 AM by kockaser

    Connection pool problem:No ManagedConnections available

    preddy

      Hi,
      I am getting the following exception when i try to get the connection from the connection pool
      (I set the max-connection pool size to 100)

      No ManagedConnections available within configured blocking timeout ( 20000 [ms] ); - nested throwable: (javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout ( 20000 [ms] ))

      Is there any way to monitor the number of connections in connection pool?

      Following is the datasource file:

      <local-tx-datasource>
      <jndi-name>defaultSource</jndi-name>
      <connection-url>jdbc:oracle:thin:@localhost:1521:host</connection-url>
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>username</user-name>
      password
      <min-pool-size>5</min-pool-size>
      <max-pool-size>100</max-pool-size>
      <max-idle-timeout>0</max-idle-timeout>
      <blocking-timeout-millis>20000</blocking-timeout-millis>
      <idle-timeout-minutes>15</idle-timeout-minutes>
      <track-statements>false</track-statements>
      </local-tx-datasource>

      Thanks

        • 1. Re: Connection pool problem:No ManagedConnections available
          maikyal

          Be sure you close connections after using them. And when you close a connection, be sure you send the appropriate event to the server registered listeners.

          • 2. Re: Connection pool problem:No ManagedConnections available
            preddy

            Thanks maikyal..

            I am using following code to close the connection after using it. But how to send the event to the server listeners.

            finally {
            try {
            if(connection != null)
            connection.close();
            } catch(Exception exception) {
            }

            Thanks

            • 3. Re: Connection pool problem:No ManagedConnections available
              haribabu_nunna

              Hai,
              I can say some solution where in helps u to monitor the no of connections getting opened used and closed.....

              First u go to JMX-console and look for Datasources and click on the link names by ur datasource name....... Then u can see all the details...

              To prevent from getting this exception I ask u to check ur code properly and look where ever ur using the database acces make it avaialble thru one class and use singleton pattern for it..

              Thus i solved my problem..........

              If u need more clarrification plz do let me know.....

              Thanks & Regards,
              Hari Babu Nunna..

              • 4. Re: Connection pool problem:No ManagedConnections available
                maikyal

                Hai again,

                As haribabu_nunna said, use singleton pattern is a good (design) solution. But seems that the root cause of you problem is that the server doesn't know when you close connections.

                When the server creates a new connection calls ManagedConnection.addEventListener(EventListner) method. It means that the server has registered a listener for the connection.

                Whe you close the ManagedConnection, somewhere in you code, you must send the "connection close event" to this listener throw the reference recived before.

                I can't tell you the correct way to do that, but I use to send this event in the ManagedConnection.Clean() method.

                I hope this can help you.

                • 5. Re: Connection pool problem:No ManagedConnections available

                  The comments about firing connection close from cleanup() are rubbish.

                  The rest is an FAQ.

                  • 6. Re: Connection pool problem:No ManagedConnections available
                    maikyal

                    Hello Adrian,
                    I think you don't understand me. I'm sorry about my english.
                    I'm not talking about closing connecions from cleanup(). I'm talking about sending close evets to the listeners from that method. In any case I can be wrong and comments like "are rubbish" doesn't help me.

                    • 7. Re: Connection pool problem:No ManagedConnections available

                       

                      "maikyal" wrote:
                      doesn't help me.


                      This is not your thread it is preddy's.
                      Preddy is using the JBoss JDBC RAR
                      which does fire connection closed in the correct place.

                      i.e. in response to
                      java.sql.Connection.close()
                      


                      cleanup() is only invoked when the connection manager returns the connection
                      to the pool.
                      It cannot do this until the handle has informed it that the connection is no longer
                      being used by firing the close event.

                      All this is in the spec.

                      Hence your comments are rubbish/garbage i.e. off-topic and misleading.

                      • 8. Re: Connection pool problem:No ManagedConnections available
                        maikyal

                        ups

                        • 9. Re: Connection pool problem:No ManagedConnections available
                          maikyal

                           

                          "maikyal" wrote:
                          ups!!!


                          • 10. Re: Connection pool problem:No ManagedConnections available
                            kockaser

                             

                            "adrian@jboss.org" wrote:
                            "maikyal" wrote:
                            doesn't help me.


                            This is not your thread it is preddy's.
                            Preddy is using the JBoss JDBC RAR
                            which does fire connection closed in the correct place.

                            i.e. in response to
                            java.sql.Connection.close()
                            


                            cleanup() is only invoked when the connection manager returns the connection
                            to the pool.
                            It cannot do this until the handle has informed it that the connection is no longer
                            being used by firing the close event.

                            All this is in the spec.

                            Hence your comments are rubbish/garbage i.e. off-topic and misleading.


                            I was looking for solution of the similar problem and here we are ?.

                            It is unbelievable how big human arrogance can be, a Adrian?

                            I believe that the Chief Scientist can and must do better than in the above answers or we are all rubbish/garbage.

                            Thx

                            P.S.
                            Do we really need to come here to be offended?