Hi, The keep alive on postgres was already setup, but was not working. However, I finally found a workaround.
I'm using the tomcat connexion pool, but For the authentication, Tomcat is creating its own connexion and does not use the pool (and seems to use the same connexion all along the session). So I think that's was why it was dropped by the firewall after a while, and when we restarted tomcat, the connexion was recreated and it worked again. To resolve this problem, we override Tomcat's authenticate method. We made our own open function which uses the postgres driver and is called in the authenticate. We do not use the getPassword and getRoles function, because they used the Tomcat's "global" connexion. With this, we are now able to connect to the site even after a long period of inactivity. Thank you for your help, and maybe this could help someone else. Regards, Luc. ________________________________________ De : Felix Schumacher <felix.schumac...@internetallee.de> Envoyé : mercredi 4 février 2015 20:11 À : Tomcat Users List Objet : Re: JDBC authentication problem Am 04.02.2015 um 14:21 schrieb Luc DALLEMANE: > Hi, > > I'm back again with the problem :) > > Firstly, I add the validationQuery and it works and I can see it in postgres > logs. > > But still not able to login after a while of inactivity.... > > Now, after 15 min of waiting, I'm getting a socket connexion timeout, but > seems logic after such a long period of trying to connect. > > Thank you again for your ideas and haven't found a solution. You might try to enable keepalive on your postgresql connection. Connection porperties can be specified with the attribute "connectionProperties" (at least according to http://commons.apache.org/proper/commons-dbcp/configuration.html) or in the jdbc url jdbc://...?tcpKeepAlive=true. You can even specify the timeout for connnecting to your database. Regards Felix > > Regards, Luc. > ________________________________________ > De : Konstantin Kolinko <knst.koli...@gmail.com> > Envoyé : mardi 3 février 2015 12:33 > À : Tomcat Users List > Objet : Re: JDBC authentication problem > > 2015-02-03 14:29 GMT+03:00 Luc DALLEMANE <ldallem...@alaloop.com>: >> Hi, >> >> Thanks for the reply, I tried to add the options you told me about >> (testWhileIdle, timeBetweenEvictionRunsMillis, and maxConnLifetimeMillis), >> but I'm still unable to log after un hour ... > Do you have validationQuery configured? testOnBorrow, testWhileIdle > do not work without it. > > > Best regards, > Konstantin Kolinko > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org