7 Replies Latest reply on Sep 5, 2001 11:22 AM by thedug

    Oracle Connection Pool Hanging at Startup

    timhaley

      In the past, there have been a lot of messages on the mailing list about this issue. However, I never saw a solution.

      The issue is this:
      - Correctly set up an Oracle database connection pool in jboss.jcml (The pool works fine under normal circumstances)
      - The database cannot be reached when jboss starts up. (e.g. both are started at boot-up and the database is not ready when JBoss starts)
      - When JBoss attempts to verify the connection it hangs at the following point:

      ...
      INFO root JDBC provider - Starting
      INFO root JDBC provider - Started
      INFO root jdbc/Orcl - Starting
      INFO root jdbc/Orcl - XA Connection pool jdbc/Orcl bound to java:/jdbc/Orcl
      

      No exception is thrown, no retries appear to occur.
      If you turn on logging in the pool definition, you get more information:
      ...
      INFO root JDBC provider - Starting
      INFO root JDBC provider - Started
      INFO root jdbc/Orcl - Starting
      INFO root jdbc/Orcl - XA Connection pool jdbc/Orcl bound to java:/jdbc/Orcl
      INFO root jdbc/Orcl - java.sql.SQLException: Io exception: The Network Adapter could not establish the
       connection
      INFO root jdbc/Orcl - Pool jdbc/Orcl factory org.opentools.minerva.jdbc.xa.XAConnectionFactory@32321
      0 unable to create new object!
      INFO root jdbc/Orcl - Pool jdbc/Orcl [0/0/10] waiting for a free object
      

      Does anyone have a solution for this?
      It is not acceptable for the JBoss startup to just hang.
      Is is a JBoss problem, or is it an Oracle jdbc driver problem? Do other databases have this issue?

      If you need to see the relevant portion of JBoss.jcml, here it is:


      <!-- JDBC -->

      oracle.jdbc.driver.OracleDriver



      jdbc/Orcl
      org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl

      jdbc:oracle:thin:@localhost:1521:Orcl
      1200000
      scott
      10
      tiger
      false
      true
      false
      true
      120000
      1800000
      false
      true
      1.0
      0



        • 1. Re: Oracle Connection Pool Hanging at Startup
          smagoun

          I second the motion....at least some useful output in normal (not debug) mode would be nice, since this is an error condition that's not obvious to most people. Our web guys are using JBoss to build a frontend for our app, and they have a bad habit of not setting up their systems correctly. Even a message that says "Database connection broken" would be useful, since they wouldn't panic about "it just stopped working!"

          • 2. Re: Oracle Connection Pool Hanging at Startup

            The only time I have encounterd this problem is when the Data source definition is wrong. Check your URL is correct - right SID, etc. Is your tnslistener running? Another problem I have found (but it's probably not applicable here as you are using the thin driver and are using localhost) is if you rename your machine you will have entries in listener.ora which refer to the old machine name.

            • 3. Re: Oracle Connection Pool Hanging at Startup
              deanf

              TimHaley,

              I had the exact same problem. After reading your question and the answers, I wrote a small Java program that connected using the thin driver. That program did not get a connection, so I knew it was not JBoss. I ended up rebooting my Linux box that hosts the db. Once I did that and restarted the database and listener, the program worked. I then tried JBoss and it worked. I tried my program a couple of more times and it failed after a couple of connects. Therefore, I have a problem in my database someplace. That being said, you can use the code below (modified for your URL) to test your driver.

              import java.sql.*;
              import oracle.jdbc.driver.*;
              import java.math.*;

              public class Test {
              public static void main(String[] args) {
              System.out.println("starting test program");

              try {
              DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
              Connection conn2 = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.111:1521:ora8",
              "scott",
              "tiger");
              System.out.println("Got connection");
              }
              catch (Exception e) {
              System.out.println(e);
              }
              }
              }



              I found out that the listener was confused or my db was confused. I'm running Oracle 8 on Linux - I rebooted, started the db and the tnslsnr process - once I did, everything worked fine.

              I figured out I had a problem by writing a

              • 4. Re: Oracle Connection Pool Hanging at Startup
                deanf

                Me again - forget the junk on the bottom of the previous reply - left over bytes.

                After further review, I think that everything is OK until I run JBoss. When I start JBosss, it gets a connection OK, but then I can't get one using another Java program (like the test program I supplied above). This happens even after shutting JBoss down. I have to kill and restart the tnslsnr process on the database host to resolve the problem.

                Note - this happens most of the time, although once it only failed after starting JBoss, stopping it and then restarting it.

                Sooooooooo, what is JBoss doing and why?

                • 5. Re: Oracle Connection Pool Hanging at Startup
                  thedug

                  JBoss tests connections.. If it can't get a connection it blocks.. if blocking is set to true. Which is what you are witnessing. I believe jBoss 2.4 has a timeOut setting for blocking...

                  • 6. Re: Oracle Connection Pool Hanging at Startup
                    atatinen

                    this could be really dumb...but just for the kicks please change ur name in the URL to actual name of ur machine or IP number (not 127.0.0.1).

                    i had a similar problem and that resolved my issue. i am not sure if it is the same but if it is well and good.
                    the problem seems with the thin driver that it actually tries to do a DNS resolution.

                    well its just a thought...give it a try and please let me know if it works.

                    • 7. Re: Oracle Connection Pool Hanging at Startup
                      thedug

                      Also, did you notic that the SIDs are different?