-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Douglas,
On 6/12/15 8:13 PM, Douglas Schaible wrote: > Hi Chris, > > I have the connection pool defined in /etc/tomcat8/context.xml. Is > that the wrong place the define it? Most likely. That file (if I'm guessing correctly about your package manager's intent) is the same at Tomcat's standard conf/context.xml, which is the default configuration for every web application that will be deployed on the server. If you deploy another application, you may get another copy of the connection pool. The best place to define a connection pool is in the application's META-INF/context.xml file. > Is what is defined there being copied into each application? Yes. > I underplayed some sample application and I am now seeing 10 time > the number of apps being deployed DB connections. > I am creating war files from eclipse to be deployed. Should I be > creating a context file in eclipse so that it is included in the > war file? Yes. I don't know exactly how Eclipse handles these things, but I would create a META-INF/context.xml file and make sure it makes it into the deployment directory along with the rest of the application. > If yes, should I copy the context.xml from from /etc/tomcat8 and > then remove the pool definition from that file and just have it in > the one in the war file? Yes. Editing conf/context.xml is usually not a great idea. > Responses to the questions are below. > > I have also implemented what Filip recommended, however after 24 > hours the app start intermittently failing and there are only 2 > open connections to the DB. > > This is in the log: > com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last > packet successfully received from the server was 79,290,702 > milliseconds ago. The last packet sent successfully to the server > was 79,290,702 milliseconds ago. is longer than the server > configured value of 'wait_timeout'. You should consider either > expiring and/or testing connection validity before use in your > application, increasing the server configured values for client > timeouts, or using the Connector/J connection property > 'autoReconnect=true' to avoid this problem. > > 12-Jun-2015 16:51:55.659 WARNING [Tomcat JDBC Pool > Cleaner[147643626:1434048550658]] > org.apache.tomcat.jdbc.pool.ConnectionPool.abandon Connection has > been abandoned > PooledConnection[com.mysql.jdbc.JDBC4Connection@1fa3cd0e]:java.lang.Ex ception You > likely have a connection leak in your code. > 79,290,702 milliseconds is ~22 hours if my calculations are > correct. That is way way longer than what is specified. > > Here is what I added: logAbandoned="true" removeAbandoned="true" > removeAbandonedTimeout="60" timeBetweenEvictionRunsMillis="15000" If removeAbandoned is configured (like you have above), then connections deemed "abandoned" will be dropped from the pool and a new connection should be created to take its place. The "logAbandoned" should be showing you a stack trace from the place where the connection was checked-out of the pool. You can look at the application code near there to find out why the connection isn't being returned. I recommend that you read this: http://blog.christopherschultz.net/index.php/2009/03/16/properly-handlin g-pooled-jdbc-connections/ - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJVfuUbAAoJEBzwKT+lPKRYdVYP/3Vgn2mqWUuAhWLCL4d4S5CQ iyM41a0MGZx/EMZon9/nNrEPYpevtC1CQDX3m4d+YFvtbpEUBJBzu7zOyhJ2MgeM IbqsknRa+vVTdDDmscn4HYo5EpeUG0MFvCt2UzphGie23AL2PP7m+P/QzVOdbHxx kxkfr/dMOGVCi1JCvzSXoPU1E4IoSnOWuREWa+iyN62c5OVqtk3MD4FD41cslUOO x4fZz12vQEd/BO5tR57vAw4DRxW4qPs6JErlXNkdcy4QAs7Zjz25l55zeMc3mm1I YY/P4NQ9ygA6JhqAW/OowH0Q61zDfdIE0hJ7arc0bTbu83rD+xoi2bqAfo0cXtY8 KrMg4nPk0sXQgKjHVgMn9L436kIZezgikA4H36AHl1doMTCYId4gPy+3p59cszpv 4sEl7PamYbzz6piOLlInlKyGFdbh3rDMI1V5qphFWepkfmHtm/+CevfaL+P541Hx 2A2xUsJo6JPBOBJZZVvpbaoqk3ix+INgsoi6i5ruBBJm+KyuFFxovbPzBXkT9dWH xOVuj3kj1vqlJ9J7qQWubnk6r+wVGakaLRiXHoHDEAJrhLl42RPWA+2KFXIbBjbN 2/D2DWMbt/J+jJkiZeL37obE0rSk+fPSj0BIx07L1q8HXdVuy5kvX1ZUhzSsYY2A u+ivxC77iMNU1K/jr2PJ =HW4e -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org