you can change the validation query and check if it has any effect the weird part is this error looks like a stored proc issue (driver version?).
Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://blog-rmannibucau.rhcloud.com> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory <https://javaeefactory-rmannibucau.rhcloud.com> 2017-01-19 19:31 GMT+01:00 KARR, DAVID <[email protected]>: > > -----Original Message----- > > From: Romain Manni-Bucau [mailto:[email protected]] > > Sent: Thursday, January 19, 2017 9:50 AM > > To: [email protected] > > Subject: Re: How do deal with occasional "Failed to validate a newly > > established connection." > > > > default is tomcat-jdbc (tomcat pool implementation) > > > > so there is an issue with your validation query or pool configuration if > > it fails whatever pool you use. I think you can connect through JMX and > > tune it there, will avoid some restarts. > > Ok, I connected from visualvm, and I'm looking at the datasource > properties. I'm not sure what to look for here. Are you just saying that > if I was going to change these settings, I could do it interactively > instead of restarting? Ok. Nevertheless, I don't see what I can tune to > make this stop happening. > > > 2017-01-19 18:46 GMT+01:00 KARR, DAVID <[email protected]>: > > > > > > -----Original Message----- > > > > From: Romain Manni-Bucau [mailto:[email protected]] > > > > Sent: Thursday, January 19, 2017 9:31 AM > > > > To: [email protected] > > > > Subject: Re: How do deal with occasional "Failed to validate a newly > > > > established connection." > > > > > > > > this is linked to the pool configuration and the connection state. > > > > Guess you'll need to investigate oracle configuration and maybe > > > > debug tomcat- jdbc. A quick test can be to switch to dbcp > > > > (DataSourceCreator=dbcp) and see if it happens too > > > > > > Yes, that produced similar exceptions. Without dbcp (what is it if I > > > don't set it to dbcp?) I saw 20 immediate validation exceptions (2 * > > > maxActive, I'm guessing), even before it got to my queries. When I > > > turned on dbcp, it seemed to delay the pool creation until the first > > > query, so I got all the same exceptions at that point. > > > > > > > 2017-01-19 18:29 GMT+01:00 KARR, DAVID <[email protected]>: > > > > > > > > > > -----Original Message----- > > > > > > From: Romain Manni-Bucau [mailto:[email protected]] > > > > > > Sent: Thursday, January 19, 2017 9:25 AM > > > > > > To: [email protected] > > > > > > Subject: Re: How do deal with occasional "Failed to validate a > > > > > > newly established connection." > > > > > > > > > > > > this is linked to the pool validations, not your business code I > > > > > > think > > > > > > > > > > Ok, that was somewhat obvious to me also, but what can I do about > > it? > > > > > > > > > > It's odd that this is only happening with one of the two queries, > > > > > both of which are perfectly fine. > > > > > > > > > > > 2017-01-19 18:19 GMT+01:00 KARR, DAVID <[email protected]>: > > > > > > > > > > > > > > -----Original Message----- > > > > > > > > From: KARR, DAVID > > > > > > > > Sent: Wednesday, January 18, 2017 5:02 PM > > > > > > > > To: [email protected] > > > > > > > > Subject: How do deal with occasional "Failed to validate a > > > > > > > > newly established connection." > > > > > > > > > > > > > > > > I've got a small app running in Tomee. It runs a couple of > > > > > > > > Oracle db queries every two minutes. I'm getting errors > > > > > > > > like this every once in a > > > > > > > > while: > > > > > > > > --------------- > > > > > > > > Caused by: java.sql.SQLException: Failed to validate a newly > > > > > > > > established connection. > > > > > > > > > > > > > > Some other aspects of this are: > > > > > > > > > > > > > > I'm using the same DAO class to run two different queries. > > > > > > > I've run the app in the debugger and directly tested the > > > > > > > queries in my SQL > > > > > > browser. > > > > > > > Both queries are fine. In fact, when the app starts up, I get > > > > > > > valid results from both queries for a few minutes. Then, the > > > > > > > second query of the two simply starts failing with this error > > > > > > > every time. The first query never has a problem. Both > > > > > > > queries are similar, simply returning a different set of > > > > > > > columns and > > > > aggregates on the same table. > > > > > > > > > > > > > > When I restart the tome instance, the cycle starts over again. > > > > > > > > > > > > > > > > > > > > > > >
