Hello Mark, i'm using the EasyMock to test the creation of the BasicDataSource :
BasicDataSource ds = prepareDataSource(); //set the properties of the basic data source Connection connection = ds.getConnection(); // throw an error here The properties that is set is bds.setMaxTotal(maxTotal); bds.setMinIdle(minIdle); bds.setMaxIdle(maxIdle); bds.setNumTestsPerEvictionRun(numTestsPerEvictionRun); bds.setMaxWaitMillis(maxWaitMillis); bds.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); bds.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); bds.setTestOnBorrow(true); i do set the bds.setValidationQuery("Select 1") after checking the source code and manage to proceed to have another error : *java.lang.NullPointerException: while trying to invoke the method java.sql.PreparedStatement.executeQuery() of a null object loaded from field org.apache.tomcat.dbcp.dbcp2.PoolableConnection.validationPreparedStatement of an object loaded from local variable* >From what i see, the BDS expect a return row result from the driver, and as i am using a "fake" driver, there is no return row, i'm just not sure based on my trial. sorry if my question is a little bit weird, it is a first time for me. Roy On Wed, Aug 3, 2016 at 3:29 PM, Mark Thomas <ma...@apache.org> wrote: > On 03/08/2016 01:46, Roy Leonardus wrote: > > Dear All, > > > > I tried to create a new BasicDataSource and encountered such error > > Let me just see if I can find Pid's crystal ball so I know how you tried > to create a new BasicDataSource and the state of the system on which you > were trying to do that... > > > java.sql.SQLException: Cannot create PoolableConnectionFactory (isValid() > > returned false) > > > > this is caused by this method in the PoolableConnection > > <snip removed="unreadable code snippets" /> > > > problem here is : i have not set any timeout with the > > setValidationQueryTimeout, but the error appears. > > > > > > I also do not encounter such error in my tomcat 7 runtime. > > > > > > Could you guys give some hints? the expectation is of course to > > eliminate such error > > With the information you have provided so far? No. > > You need to read this: > http://www.catb.org/esr/faqs/smart-questions.html > > and then try again. > > Mark > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >