slick 3.1.1 provisioning error in the configuration how can I get this working

53 views
Skip to first unread message

hernand...@gmail.com

unread,
Jan 22, 2016, 1:51:03 PM1/22/16
to Slick / ScalaQuery
I am new to slick and am using version 3.1.1 along with the playframework 2.4.6 . I am following this guide in the documentation http://slick.typesafe.com/doc/3.1.1/database.html . The error I am getting is

    ***ProvisionException: Unable to provision, see the following errors:


   
1) Error injecting constructor, java.lang.RuntimeException: java.lang.ClassNotFoundException:
    org
.postgresql.ds.PGSimpleDataSource
      at controllers
.Application.<init>(Application.scala:12)
     
while locating controllers.Application
       
for parameter 1 at router.Routes.<init>(Routes.scala:31)
     
while locating router.Routes
     
while locating play.api.inject.RoutesProvider
     
while locating play.api.routing.Router
   
1 error***


This is what I have first in the SBT I put this

    libraryDependencies ++= Seq(
     
"com.typesafe.slick" %% "slick" % "3.1.1",
     
"org.slf4j" % "slf4j-nop" % "1.6.4"
   
)

Then in my Application.Conf I put this

    mydb = {
      dataSourceClass
= org.postgresql.ds.PGSimpleDataSource
      properties
= {
        databaseName
= "mydatabasename"
        user
= "postgres"
        password
= "mypassword"
     
}
      numThreads
= 10
   
}

Then finally in my controller I just have the connection string
package controllers 





   
import javax.sql.DataSource
   
   
import org.mindrot.jbcrypt.BCrypt
   
import play.api._
   
import play.api.mvc._
   
import slick.driver.PostgresDriver.api._
   
import scala.concurrent.ExecutionContext.Implicits.global
   
   
   
class Application extends Controller {


      val db
= Database.forConfig("mydb")
     
try {
       
// ...
     
} finally db.close()
   
   




     
def index = Action {


       
Ok("My First Controller")
     
}
   
   
}


The error seems to be coming from  val db = Database.forConfig("mydb")

As you can see I put the postgres driver instead of the H2 since I'm working with postgres and those credentials are the correct ones and verified.

        databaseName = "mydatabasename"
        user 
= "postgres"
        password 
= "mypassword"





Reply all
Reply to author
Forward
0 new messages