You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package io.mydomain.persistence
import com.github.tminglei.slickpg._
import slick.driver.JdbcProfile
import slick.basic.Capability
import play.api.libs.json.{Format, Json, JsValue}
trait PostgresProfile
extends ExPostgresProfile
with PgArraySupport
with PgDate2Support
with PgRangeSupport
with PgHStoreSupport
with PgPlayJsonSupport
with PgSearchSupport
with PgPostGISSupport
with PgNetSupport
with PgLTreeSupport {
def pgjson = "jsonb"
override val api = MyAPI
object MyAPI extends API with ArrayImplicits
with DateTimeImplicits
with JsonImplicits
with NetImplicits
with LTreeImplicits
with RangeImplicits
with HStoreImplicits
with SearchImplicits
with SearchAssistants {
implicit val strListTypeMapper = new SimpleArrayJdbcType[String]("text").to(_.toList)
implicit val playJsonArrayTypeMapper =
new AdvancedArrayJdbcType[JsValue](pgjson,
(s) => utils.SimpleArrayUtils.fromString[JsValue](Json.parse(_))(s).orNull,
(v) => utils.SimpleArrayUtils.mkString[JsValue](_.toString())(v)
).to(_.toList)
}
}
object PostgresProfile extends PostgresProfile
Actual Behavior
Fails to connect to database when
play.api.Configuration$$anon$1: Configuration error[Cannot connect to database [default]]
at play.api.Configuration$.configError(Configuration.scala:155)
at play.api.Configuration.reportError(Configuration.scala:394)
at play.api.db.slick.DefaultSlickApi$DatabaseConfigFactory.create(SlickApi.scala:99)
at play.api.db.slick.DefaultSlickApi$DatabaseConfigFactory.get$lzycompute(SlickApi.scala:87)
at play.api.db.slick.DefaultSlickApi$DatabaseConfigFactory.get(SlickApi.scala:86)
at play.api.db.slick.DefaultSlickApi.dbConfig(SlickApi.scala:70)
at TestApp.dbConfig$lzycompute(Loader.scala:36)
at TestApp.dbConfig(Loader.scala:36)
at TestApp.signUpCodesService$lzycompute(Loader.scala:42)
at TestApp.signUpCodesService(Loader.scala:42)
Caused by: slick.SlickException: Error getting instance of profile "io.mydomain.persistence.PostgresProfile$"
at slick.basic.DatabaseConfig$.forConfig(DatabaseConfig.scala:95)
at play.api.db.slick.DefaultSlickApi$DatabaseConfigFactory.create(SlickApi.scala:95)
at play.api.db.slick.DefaultSlickApi$DatabaseConfigFactory.get$lzycompute(SlickApi.scala:87)
at play.api.db.slick.DefaultSlickApi$DatabaseConfigFactory.get(SlickApi.scala:86)
at play.api.db.slick.DefaultSlickApi.dbConfig(SlickApi.scala:70)
at TestApp.dbConfig$lzycompute(Loader.scala:36)
at TestApp.dbConfig(Loader.scala:36)
at TestApp.signUpCodesService$lzycompute(Loader.scala:42)
at TestApp.signUpCodesService(Loader.scala:42)
at TestApp.signUpCodesController$lzycompute(Loader.scala:55)
Caused by: java.lang.ClassNotFoundException: io.mydomain.persistence.PostgresProfile$
at java.base/java.lang.ClassLoader.findClass(ClassLoader.java:719)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at slick.util.ClassLoaderUtil$$anon$1.loadClass(ClassLoaderUtil.scala:17)
at slick.basic.DatabaseConfig$.forConfig(DatabaseConfig.scala:92)
at play.api.db.slick.DefaultSlickApi$DatabaseConfigFactory.create(SlickApi.scala:95)
at play.api.db.slick.DefaultSlickApi$DatabaseConfigFactory.get$lzycompute(SlickApi.scala:87)
at play.api.db.slick.DefaultSlickApi$DatabaseConfigFactory.get(SlickApi.scala:86)
at play.api.db.slick.DefaultSlickApi.dbConfig(SlickApi.scala:70)
at TestApp.dbConfig$lzycompute(Loader.scala:36)
Reproducible Test Case
The issue goes away when I simply change the Play plugin version from 2.8.2 to 2.8.1
The text was updated successfully, but these errors were encountered:
alternegro
changed the title
In Play 2.8.2, slick.dbs.default.profile config throws ClassNotFound exception When using custom Profile
In Play 2.8.2, slick.dbs.default.profile config throws ClassNotFound exception when using custom Profile
Jul 23, 2020
I have the same problem in 2.8.1 somtimes on recompiles, also using akka-persistence with the normal jdbc driver in the same application.
restarting sbt fixes it. It seems to always happen if akka-persistence starts up earlier then the migration I think?
I have several apps using 2.8.1, but I’m yet to encounter the issue in them. The issue shows up EVERY time I’ve tried 2.8.2. I’m working on an Akka application write now, I’ll look out for the issue there as well. I cross posted this issue in slick-pg and others have reported seeing it.
Corresponding Slick PG Issue
Play Slick Version
5.0.0
Play Version
2.8.2
API
Scala 2.13.2
Operating System
macOS 10.15.5
JDK
java version 11
Library Dependencies
Expected Behavior
Actual Behavior
Reproducible Test Case
The issue goes away when I simply change the Play plugin version from 2.8.2 to 2.8.1
The text was updated successfully, but these errors were encountered: