Slick & sqlite: Failed to create class tests. SqliteSpec: org.sqlite.JDBC

I am trying to start the application with scala, play, slick, specs2 and sqlite.here is a sign of sqlite integration:

import scala.slick.driver.SQLiteDriver.simple._ import metier.Objets._ import scala.slick.lifted.ProvenShape import java.sql.Date package models { trait sqlite { val db = Database.forURL("jdbc:sqlite:rdvs.txt", driver = "org.sqlite.JDBC") //val db = Database.forDataSource(DB.getDataSource()) class Personnes(tag: Tag) extends Table[Rdv](tag, "RDV") { def id = column[Int]("ID", O.PrimaryKey, O.AutoInc) def nom = column[String]("NOM", O.NotNull) def prénom = column[String]("PRENOM") def sexe = column[Int]("SEXE") def télPortable = column[String]("TELPOR") def télBureau = column[String]("TELBUR") def télPrivé = column[String]("TELPRI") def siteRDV = column[String]("SITE") def typeRDV = column[String]("TYPE") def libelléRDV = column[String]("LIBELLE") def numRDV = column[String]("NUMRDV") def étape = column[String]("ETAPE") def dateRDV = column[Date]("DATE") def heureRDVString = column[String]("HEURE") def statut = column[String]("STATUT") def orderId = column[String]("ORDERID") def * = (id.?, nom, prénom, sexe, télPortable, télBureau, télPrivé, siteRDV, typeRDV, libelléRDV, numRDV, étape, dateRDV, heureRDVString, statut, orderId) <> (Rdv.tupled, Rdv.unapply _) } } } 

The test is as follows:

 package tests { @RunWith(classOf[JUnitRunner]) class SqliteSpec extends Specification with sqlite { sequential "la base sqlite" should { "create a new database file" in new Sqlite_avant_chaque_test { todo } } class Sqlite_avant_chaque_test extends Scope { println("avant test") //db.withDynSession { db.withSession { implicit session: Session => val personnes = TableQuery[Personnes] personnes.ddl.create println("avant tests, après création base") } } } } 

and when I run the test in eclipse, I get this error:

 java.lang.Exception: Could not instantiate class tests.SqliteSpec: org.sqlite.JDBC 

In my test class, I have this import:

 import scala.slick.driver.SQLiteDriver.simple._ 

which should load the sqlite driver.

Could you help me?

0
source share

Source: https://habr.com/ru/post/1209788/


All Articles