applctv / gcp-scala-datastore

Scala wrapper to Google Cloud Datastore operations
15 stars 16 forks source link

how to import this as dependency in sbt project? #20

Closed xiangpeng19 closed 7 years ago

xiangpeng19 commented 7 years ago

Hi I'm setting up my project using sbt. How can I add this dependency into my project?

Thanks in advance.

danosipov commented 7 years ago

@lxp1991 You should just be able to add the dependency & resolver, ie:

libraryDependencies ++= Seq(
  "io.applicative" %% "datastore-scala-wrapper" % "1.0-rc8"
)

resolvers ++= Seq(
  "applctv-bintray" at "https://dl.bintray.com/applctv/gcp-scala-datastore/"
)
xiangpeng19 commented 7 years ago

@danosipov Thanks for your quick response. I successfully import it into my project.

However it will throw runtime exception when I use it in Play framework. It directly shutdown my JVM and throw the following errors. Is this because it's not compatible with Akka or I did something wrong?

a.a.ActorSystemImpl - Uncaught error from thread [application-akka.actor.default-dispatcher-5]: null, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[application] java.lang.ExceptionInInitializerError: null

Codes: case class DayStats(id: String, timestamp: Long) extends BaseEntity DatastoreService.add[DayStats](dayStats)

Environment: Play Framework: 2.6.5 Scala: 2.12.3 datastore-scala-wrapper: 1.0-rc8

Thanks

a-panchenko commented 7 years ago

@lxp1991 Did you provide an implicit ExecutionContext?

xiangpeng19 commented 7 years ago

@a-panchenko Yes, I provided the ExecutionContext

danosipov commented 7 years ago

@lxp1991 We're using the library with Play Framework and don't have this error. If you can find a more detailed stacktrace, that would help understand the cause.

xiangpeng19 commented 7 years ago

@danosipov @a-panchenko Thanks for responding. I found the issue is that I also import the Google native JAVA datastore JDK. It's working perfectly after I remove it.