No matching driver found by connection pool

I have an application for the game 2.1, which I am testing with the unit. My tests work well and are able to perform database operations. Obviously, the driver ( org.postgresql.Driver ) is loaded.

However, between tests, it seems that the connection pool has problems accessing the driver. Below is a snippet of a typical sequence from my journal. Does anyone know why there may be a problem with access to the driver in this connection pool when the application is ok?

 [info] application - QuickWitness Server shutdown... [error] cjbhAbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 10. Exception: null [error] cjbConnectionHandle - Database access problem. Killing off all remaining connections in the connection pool. SQL State = 08001 [error] cjbPoolWatchThread - Error in trying to obtain a connection. Retrying in 1000ms java.sql.SQLException: No suitable driver found for jdbc:postgresql:qw at java.sql.DriverManager.getConnection(DriverManager.java:602) ~[na:1.6.0_26] at java.sql.DriverManager.getConnection(DriverManager.java:185) ~[na:1.6.0_26] at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:256) ~[bonecp.jar:0.7.1.RELEASE] at com.jolbox.bonecp.ConnectionHandle.obtainInternalConnection(ConnectionHandle.java:211) ~[bonecp.jar:0.7.1.RELEASE] at com.jolbox.bonecp.ConnectionHandle.<init>(ConnectionHandle.java:170) ~[bonecp.jar:0.7.1.RELEASE] at com.jolbox.bonecp.PoolWatchThread.fillConnections(PoolWatchThread.java:101) [bonecp.jar:0.7.1.RELEASE] [info] application - QuickWitness Server has started [debug] application - entering ensureTriggersAndStoredProceduresAreInstalled() [debug] application - exiting ensureTriggersAndStoredProceduresAreInstalled() [info] application - logging initialized [info] application - Register user request from localhost:12345 [info] application - QuickWitness Server shutdown... [error] cjbhAbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 10. Exception: null [error] cjbConnectionHandle - Database access problem. Killing off all remaining connections in the connection pool. SQL State = 08001 [error] cjbPoolWatchThread - Error in trying to obtain a connection. Retrying in 1000ms java.sql.SQLException: No suitable driver found for jdbc:postgresql:qw at java.sql.DriverManager.getConnection(DriverManager.java:602) ~[na:1.6.0_26] at java.sql.DriverManager.getConnection(DriverManager.java:185) ~[na:1.6.0_26] at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:256) ~[bonecp.jar:0.7.1.RELEASE] at com.jolbox.bonecp.ConnectionHandle.obtainInternalConnection(ConnectionHandle.java:211) ~[bonecp.jar:0.7.1.RELEASE] at com.jolbox.bonecp.ConnectionHandle.<init>(ConnectionHandle.java:170) ~[bonecp.jar:0.7.1.RELEASE] at com.jolbox.bonecp.PoolWatchThread.fillConnections(PoolWatchThread.java:101) [bonecp.jar:0.7.1.RELEASE] [info] application - QuickWitness Server has started 
+4
source share
3 answers

I had the same problem. In my case, the problem arose due to the lack of connections to the database. It seems that the game will not close the connections at the end of the block. The documentation tells a different story, so maybe this is a mistake in the game?

Solution 1: you can increase your connections in your .conf application by changing ( http://www.playframework.com/documentation/2.1.0/SettingsJDBC )

 db.default.partitionCount=2 db.default.maxConnectionsPerPartition=5 db.default.minConnectionsPerPartition=5 

Solution 2. You can close your connections after use ( http://www.playframework.com/documentation/2.0/ScalaDatabase )

 DB.withConnection { conn => // do whatever you need with the connection conn.close() } 
+1
source

I assume that you have placed the correct driver correctly in the / Project / lib folder

1) check the database url configuration in application.conf.

2) add "evolutionplugin = disabled" to application.conf

3) Refer to http://digitalsanctum.com/2012/05/30/play-framework-2-tutorial-database-access/ , add the dependency to build.scala?

Thanks, hope can help ~~

0
source

I had the same problem with squeryl. There seems to be nothing wrong with my code. I think this is happening: due to unit tests, my application starts and stops sequentially many times. Playback closes connections when the application is stopped. However, if your machine is fast enough, it may request new connections when you start the application before those that were used in the last start were closed. It is just a matter of time. You can solve this either by increasing the maximum number of db connections, or simply sleeping for a short time at the end of Global onStop.

0
source

All Articles