4 Replies Latest reply on May 16, 2005 2:25 PM by Rodrigo Baptista

    No ManagedConnections available

    chakrapani prakhya Newbie

      hi,
      i am using jboss-3.2.4 with Oracle9i database.my Oracle-ds.xml is
      <local-tx-datasource>
      <jndi-name>OracleDS</jndi-name>
      <connection-url>jdbc:oracle:oci:@oracl</connection-url>
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <application-managed-security/>
      <user-name>xx</user-name>
      xx
      <prepared-statement-cache-size>50</prepared-statement-cache-size>
      <min-pool-size>1</min-pool-size>
      <max-pool-size>50</max-pool-size>
      <max-idle-timeout>0</max-idle-timeout>
      <blocking-timeout-millis>30000</blocking-timeout-millis>
      <idle-timeout-minutes>15</idle-timeout-minutes>
      <track-statements>false</track-statements>
      <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
      </local-tx-datasource>
      and MY PROBLEM IS after some time accesing my application,my oracle connection fails.and in my server i am getting error like


      jvm 1 [STDOUT] Database error at createConnection:
      org.jboss.util.NestedSQLException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] ); - nested throwable:
      (javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout( 30000 [ms] ))

      this my problem,
      can any one help me to solve this problem.
      thanq

        • 1. Re: No ManagedConnections available
          Santosh Korde Newbie

          Hi you need to increase the value of block out time from 30000 to say 70000
          <blocking-timeout-millis >30000 </blocking-timeout-millis >
          Another thing is make sure you are closing all connections in the custom code you have written

          • 2. Re: No ManagedConnections available and Connections are not
            kashi ram Newbie

            Hi,

            I am also getting the same problem. I am using Jboss 3.2.3 and Postgresql 8.0 windows version. I found that connections are not getting closed or they are returned to pool even though my code is seems to be right. Ultimately all connections are open and finally i need to restart the jboss. I am writing the code for getting connection like this:

            import java.sql.Connection;
            import javax.naming.InitialContext;
            import javax.naming.Context;
            import javax.naming.NamingException;
            import javax.sql.DataSource;


            public class DBConnection{


            static javax.sql.DataSource DataSrc = null;
            static SQLQueryProperties sqlQueryObj = null;
            static int no_connections=0;

            static
            {
            try
            {
            sqlQueryObj = SQLQueryProperties.getInstance();
            DataSrc = (DataSource)sqlQueryObj.getContext().lookup(sqlQueryObj.getProperty("DataSourceJNDI"));
            }
            catch(Exception e)
            {
            e.printStackTrace();
            }
            }

            public DBConnection() throws Exception
            {
            }

            public Connection getDBConnection() throws Exception
            {
            Connection cn=DataSrc.getConnection();
            no_connections++;
            return cn;
            }

            public Connection getConnection() throws Exception
            {
            Connection cn=DataSrc.getConnection();
            no_connections++;
            return cn;
            }
            public void returnDBConnection(Connection con) throws Exception
            {
            if(!con.isClosed()) {con.close(); no_connections--;}
            }

            public void returnConnection(Connection con) throws Exception
            {
            System.out.println("NO OF CONNECTIONS OPENED IS :"+no_connections);

            if(!con.isClosed()) {con.close(); no_connections--;}
            System.out.println("AFTER CLOSE NO OF CONNECTIONS REMAINED IS :"+no_connections);
            }

            public static int countConnections(){
            return no_connections;
            }

            }

            There is some piece of code to count the no of connections open and closed. And my postgres-ds.xml is like this:


            <local-tx-datasource>
            <jndi-name>PostgresDS</jndi-name>
            <connection-url>jdbc:postgresql://ipaddress:5432/database
            </connection-url>
            <driver-class>org.postgresql.Driver</driver-class>
            <transaction-isolation>TRANSACTION_SERIALIZABLE</transaction-isolation>
            <user-name>user</user-name>
            <min-pool-size>2</min-pool-size>
            <max-pool-size>10</max-pool-size>

            <blocking-timeout-millis>20000</blocking-timeout-millis>
            <idle-timeout-minutes>0</idle-timeout-minutes>
            </local-tx-datasource>



            I don't what to do to close the opened connections. Because of this i am facing a lot of problem in development environment.

            Please let me know what should i do to get rid of this problem.


            Thanks and Regards
            Ram

            • 3. Re: No ManagedConnections available
              Ulf Schroeter Novice

              Upgrade to at least 3.2.6 as all previous JBoss versions have a connection leak bug within the ManagedConnectionPool code.

              Regrads
              Ulf

              • 4. Re: No ManagedConnections available
                Rodrigo Baptista Newbie

                Hi,

                I cannot do an upgrade in my jboss (3.0.4), is there any patch to solve the connection leak bug?


                Thanks,
                Rodrigo