4 Replies Latest reply on May 16, 2003 10:37 PM by Orson Davis

    No ManagedConnections Available

    Jasen Halmes Newbie

      I have read through posts with this message, but none of the suggestions appear to apply to my problem.

      I have a pretty out of the box installation of jboss-3.0.3_tomcat-4.1.12 running with mysql. It has been running for several months with no problems. The application is fairly small, maybe 20 users max and maybe 5 concurrent at any one time.

      About 2 weeks ago I got this error and I first restarted mysql thinking that the problem was at the db level. That didn't fix it so I restarted jboss. Everything went back to normal and I wrote a sticky note to remind myself to go figure that out someday. Well it happened again today which has me worried. Why would it run happily for months and max out again two weeks later?

      The logs don't show any heavy activity, in fact it was the first user on a Monday morning. I am also investigating from the mysql side of things, but it didn't show any heavy use and it actually has higher connections allowed than the max of 50 in the datasource for jboss.

      It's possible that my code is not closing connections, but after months of running, I am doubtful of that. How would I figure out what is causing this from the jboss side? To me the issue has to be in either 1) my code, 2) jboss, or 3) mysql.

      If its 2) or 3) its probably a config problem I'm sure. So how would I go about figuring out a potential config issue in jboss?

      Jasen Halmes

        • 1. Re: No ManagedConnections Available
          Jon Barnett Master

          Is mySQL on a different machine to your JBoss installation? If so, is it possible that a network glitch has knocked out your connection pool? This would be the most likely cause, particularly if you never drop to a minimum of 0 connections.

          You can also check whether you are releasing connections in a short time - set your max pool to 1 or 2 connections or whatever is the maximum number of connections you would ever have open for a user session. Run a user session and see if your application breaks.

          • 2. Re: No ManagedConnections Available
            Jasen Halmes Newbie

            I am running jboss and mysql on the same machine.

            As for the release of connections, that's an interesting idea. Because I know there was no activity all weekend and Monday morning this error occurred I was curious about connection timeouts. They should be shutting as all my persistence code is using a finally{} block that does a closeAll on the connection object.

            If I drop the connections to 2, then if they aren't closing or timing out the app will break faster. Basically I would just be tuning the amount of time to wait before the failure occurs if it is dependant on the number of connections. I'll give that a try and see what happens.

            I am still perplexed as to why this would just show up all of a sudden, the network idea was a good guess, but since I am on one machine that's not likely.

            Any other ideas?

            • 3. Re: No ManagedConnections Available
              Jon Barnett Master

              Another thing to try, if you have a test machine and the time is to go for a 3.0.7 or even better a 3.2.0 JBoss version - they are more finicky about code using connections badly and will complain if mistreated. They also deal better with the database "going away".

              Are the connections for the mySQL database through the localhost or via the adapter? Can mySQL stop and start with JBoss still attached? Postgresql won't allow itself to be shutdown when there are connections - so I just want to make sure the database did not bounce.

              I take it there was nothing else that looked suspicious in the logs? And have you tried recreating/retracing the user's session that occurred when the connection pool broke?

              Other than that I cannot think of anything else to try until there is some more definitive evidence of the lead up to the problem.

              • 4. Re: No ManagedConnections Available
                Orson Davis Newbie

                It appears that I am having the same problem you have described. I am running Jboss 3.0.4 and oracle 8.1.6, using classes12.jar from oracle and the oracle thin drivers. I have jboss and oracle on different machines Sun Enterprise servers. My oracle hasn't bounced. Nothing funny going on. Network connections work fine. Over a period of days or weeks accumulate connections to the database that don't appear to be releasing and going back into the pool. netstat -na on both machines shows that the number of established connections gradually goes up and up until I run out of my maximum available and get error indicated in topic subject. I am pretty sure it is not oracle or network issue. It may be my code, but I checked all EJB's and other code that accesses database and it looks like I close everything. I am wondering if it is the inconsistency between jdbc version, the jdk version (1.4.2) and the oracle version.

                I plan to upgrade to latest oracle with appropriate jdbc jar for my jdk version.