Reputation: 13352
I was following this tutorial to star using playframework2.1 RC1 + Slick.
When try launch the SoftwareSpec test (that tests Model-like class):
play test
they fail with an error like this:
[error] SQLException: No suitable driver found for jdbc:h2:mem:test1 (DriverManager.java:190) [error] SoftwareSpec$$anonfun$1$$anonfun$apply$3.apply(SoftwareSpec.scala:25) [error] SoftwareSpec$$anonfun$1$$anonfun$apply$3.apply(SoftwareSpec.scala:25)
But I've enabled h2 db in application.conf like was mentioned in that article.
I've used latest dependencies to slick, in Build.scala file:
"com.typesafe" % "slick_2.10.0-RC1" % "1.0.0-RC1"
Once, when I changed dependency to slick to this version:
"com.typesafe" % "slick_2.10.0-RC1" % "0.11.2"
then the test was passed successfully. But after I change the test to make it fail, the error came back again - "No suitable driver". And after this all my tries (like play clean whatever) were unsuccessful.
Upvotes: 2
Views: 1376
Reputation: 1877
I got the same error when running tests on Travis CI.
A work around is loading JDBC driver class like Class.forName("org.h2.Driver")
.
Of course, I should investigate the reason of this issue and report to the Play team but I haven't done.
Upvotes: 2
Reputation: 16728
I'm not using Play at the moment, so I can't test the following, but it should be fine. For the latest Slick, you can use:
"com.typesafe" % "slick_2.10" % "1.0.0-RC1"
For h2, the following should work:
"com.h2database" % "h2" % "1.3.166"
Upvotes: 0