Open dineyw23 opened 6 years ago
Even I am getting the same error:
[info] c.s.p.d.p.ExtendedPostgresProfile - >>> binding tsrange -> com.github.tminglei.slickpg.Range
[warn] c.s.p.d.p.ExtendedPostgresProfile - >>> DUPLICATED binding for tsrange - existed: com.github.tminglei.slickpg.Range, new: com.github.tminglei.slickpg.Range !!! If it's expected, pls ignore it.
[info] c.s.p.d.p.ExtendedPostgresProfile - >>> binding tstzrange -> com.github.tminglei.slickpg.Range
[info] c.s.p.d.p.ExtendedPostgresProfile - >>> binding daterange -> com.github.tminglei.slickpg.Range
[warn] c.s.p.d.p.ExtendedPostgresProfile - >>> DUPLICATED binding for daterange - existed: com.github.tminglei.slickpg.Range, new: com.github.tminglei.slickpg.Range !!! If it's expected, pls ignore it.
[error] c.n.h.AbstractCommand - Unrecoverable Error for HystrixCommand so will throw HystrixRuntimeException and not apply fallback.
java.lang.Exception: Throwable caught while executing.
at com.netflix.hystrix.AbstractCommand.getExceptionFromThrowable(AbstractCommand.java:1976)
at com.netflix.hystrix.AbstractCommand.wrapWithOnExecutionErrorHook(AbstractCommand.java:1490)
at com.netflix.hystrix.AbstractCommand.access$1300(AbstractCommand.java:60)
at com.netflix.hystrix.AbstractCommand$ExecutionHookApplication$1.onError(AbstractCommand.java:1361)
at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:44)
at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:28)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
Caused by: java.lang.AbstractMethodError: Method com/ xyzpay/pp/dao/postgres/ExtendedPostgresProfile$MyAPI$.com$github$tminglei$slickpg$PgRangeSupport$SimpleRangeImplicits$setter$simpleLocalDateTimeRangeTypeMapper_$eq(Lslick/jdbc/JdbcType;)V is abstract
at com. xyzpay.pp.dao.postgres.ExtendedPostgresProfile$MyAPI$.com$github$tminglei$slickpg$PgRangeSupport$SimpleRangeImplicits$setter$simpleLocalDateTimeRangeTypeMapper_$eq(ExtendedPostgresProfile.scala)
at com.github.tminglei.slickpg.PgRangeSupport$SimpleRangeImplicits.$init$(PgRangeSupport.scala:74)
at com. xyzpay.pp.dao.postgres.ExtendedPostgresProfile$MyAPI$.
@dineyw23 can you provide the ExtendedPostgresProfile
's codes?
Sorry for not posting this earlier. Here's the ExtendedPostgresProfile
:
package com.example.pp.dao.postgres
/**
* Slick extensions for PostgreSQL, to support a series of pg data types and related operators/functions.
*/
import com.github.tminglei.slickpg._
import com.example.pp.dao.models.promotion.participant.ParticipantStatus
import play.api.libs.json.{JsValue, Json}
import slick.basic.Capability
import slick.driver.JdbcProfile
import scala.reflect.runtime.{universe => u}
trait ExtendedPostgresProfile extends ExPostgresProfile
with PgArraySupport
with PgDate2Support
with PgRangeSupport
with PgHStoreSupport
with PgPlayJsonSupport
with PgSearchSupport
with PgPostGISSupport
with PgNetSupport
with PgLTreeSupport {
def pgjson = "jsonb" // jsonb support is in postgres 9.4.0 onward; for 9.3.x use "json"
// Add back `capabilities.insertOrUpdate` to enable native `upsert` support; for postgres 9.5+
override protected def computeCapabilities: Set[Capability] =
super.computeCapabilities + JdbcProfile.capabilities.insertOrUpdate
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)
//Enum to db mapper for participant status
implicit val ParticipantStatusEnumMapper = MappedColumnType.base[ParticipantStatus, String](_.name, ParticipantStatus.valueOf _)
}
}
object ExtendedPostgresProfile extends ExtendedPostgresProfile
@dineyw23 can you try to change object MyAPI
to trait MyAPI
?
Just changed object MyAPI
to trait MyAPI
:
override val api = new MyAPI {}
trait MyAPI extends API with ArrayImplicits
It compiles fine. Execution gives the following error. The above posted ExtendedPostgresProfile
code works fine with version 0.15.4
:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.example.pp.dao.postgres.ExtendedPostgresProfile$
@dineyw23 when I pasted the codes to the example project play-slick-example
, and use it to replace the MyPostgresDriver
, it works well.
(p.s. I updated the slick-pg dependencies to version 0.16.1)
To dig into your issue, maybe you need create a sample project to help reproduce it.
I am getting the same error. I was previously getting AbstractMethodError as mentioned in https://github.com/tminglei/slick-pg/issues/387. But once I made it as trait + object, that error got resolved, but got IncompatibleClassChangeError. I am using 0.16.1 version. Any Idea how to solve it ?
Received exception :
Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface com.reactore.module.entity.CustomPostgresDriver, but class was expected
@yadavan88 you'd better provide a reproducable example project to allow mu to dig into, since it looks good in my test cases.
@tminglei Sure, I will create a reproducable code and provide it.
@tminglei I am not able to reproduce in a new project. I think it is some slick version mismatch. Will try to upgrade the libraries in my application to latest and check if the issue still persist or not. Thanks for the response.
@yadavan88 ok. You're welcome!
I have updated my project to latest slick-pg version to fix #400. Queries give the following error.
build.sbt
. Is this related to slick version incompatibility? I'm using Extended profile from the Readme.Error: