0
votes

I am trying to configure Slick 3.0.3 for my Play Framework 2 project. This is my configuration application.conf

db.default.url="jdbc:mysql://localhost/entquiz?characterEncoding=UTF-8"
db.default.driver="com.mysql.jdbc.Driver"
db.default.user=entquiz
db.default.pass="qFbR3CW6"
db.default.host="localhost"

In my code I am trying to connect with

val db = Database.forDataSource(DB.getDataSource())

It doesn't matter what I use (forDataSource or forConfig) I get the same error

Slick error : jdbc driver not defined in application.conf 
for db.driver.MySQL.defaultStringType.driver key

Searching in google give no results.

This is full stack trace

Configuration error[Slick error : jdbc driver not defined in application.conf for db.driver.MySQL.defaultStringType.driver key]
Configuration error: Configuration error[Slick error : jdbc driver not defined in application.conf for db.driver.MySQL.defaultStringType.driver key]
at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:94)
at play.api.Configuration.reportError(Configuration.scala:743)
at play.api.db.slick.Config$$anonfun$1.apply(Config.scala:64)
at play.api.db.slick.Config$$anonfun$1.apply(Config.scala:64)
at play.api.db.slick.Config$class.driver(Config.scala:63)
at play.api.db.slick.Config$.driver(Config.scala:77)
at play.api.db.slick.plugin.SlickDDLPlugin.evolutionScript(SlickDDLPlugin.scala:49)
at play.api.db.slick.plugin.SlickDDLPlugin$$anonfun$onStart$1$$anonfun$apply$1.apply(SlickDDLPlugin.scala:32)
at play.api.db.slick.plugin.SlickDDLPlugin$$anonfun$onStart$1$$anonfun$apply$1.apply(SlickDDLPlugin.scala:24)
at play.api.db.slick.plugin.SlickDDLPlugin$$anonfun$onStart$1.apply(SlickDDLPlugin.scala:24)
at play.api.db.slick.plugin.SlickDDLPlugin$$anonfun$onStart$1.apply(SlickDDLPlugin.scala:23)
at play.api.db.slick.plugin.SlickDDLPlugin.onStart(SlickDDLPlugin.scala:23)
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91)
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91)
at play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:91)
at play.api.Play$$anonfun$start$1.apply(Play.scala:91)
at play.api.Play$$anonfun$start$1.apply(Play.scala:91)
at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
at play.api.Play$.start(Play.scala:90)
at play.api.test.PlayRunners$class.running(Helpers.scala:48)
at play.api.test.Helpers$.running(Helpers.scala:403)
at play.api.test.WithApplication.around(Specs.scala:23)
at play.api.test.WithApplication.delayedInit(Specs.scala:20)
at ApplicationSpec$$anonfun$1$$anonfun$apply$1$$anon$1.<init>(ApplicationSpec.scala:41)
at ApplicationSpec$$anonfun$1$$anonfun$apply$1.apply(ApplicationSpec.scala:41)
at ApplicationSpec$$anonfun$1$$anonfun$apply$1.apply(ApplicationSpec.scala:41)
1
Its very strange that "slick.driver.MySQL.defaultStringType" appears in that place! Documentation says that it is configuration for default string types.Murat Mustafin

1 Answers

2
votes

It turns out that problem was with evolutions plugin. After adding play-slick-evolution dependency, problem gone.

build.sbt

"com.typesafe.play" %% "play-slick" % "1.1.0"
"com.typesafe.play" %% "play-slick-evolutions" % "1.1.0"

Also my play framework was 2.3.8, slick 3.0 works only from 2.4

plugins.sbt

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.2")