finagle / finagle-postgres

PostgreSQL protocol support for Finagle
Apache License 2.0
81 stars 39 forks source link

Exception in thread main #63

Closed milnomada closed 6 years ago

milnomada commented 7 years ago

Hello,

Testing a simple connection to a local postgresql instance with Scala 2.11, I got this exception: Exception in thread "main" java.lang.AbstractMethodError: com.twitter.finagle.stats.MetricsStatsReceiver.com

stacktrace [error] at com.twitter.finagle.stats.StatsReceiverWithCumulativeGauges$class.$init$(CumulativeGauge.scala:133) [error] at com.twitter.finagle.stats.MetricsStatsReceiver.(MetricsStatsReceiver.scala:175) [error] at com.twitter.finagle.stats.MetricsStatsReceiver.(MetricsStatsReceiver.scala:179) [error] at com.twitter.finagle.stats.MetricsStatsReceiver.(MetricsStatsReceiver.scala:180) [error] at com.twitter.finagle.stats.MetricsStatsReceiver.(MetricsStatsReceiver.scala:181) [error] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [error] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [error] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [error] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [error] at java.lang.Class.newInstance(Class.java:442) [error] at com.twitter.app.LoadService$$anonfun$5.apply(LoadService.scala:74) [error] at com.twitter.app.LoadService$$anonfun$5.apply(LoadService.scala:63) [error] at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241) [error] at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241) [error] at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) [error] at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48) [error] at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241) [error] at scala.collection.AbstractTraversable.flatMap(Traversable.scala:104) [error] at com.twitter.app.LoadService$.apply(LoadService.scala:63) [error] at com.twitter.finagle.util.LoadService$.apply(LoadService.scala:14) [error] at com.twitter.finagle.stats.LoadedStatsReceiver$.(LoadedStatsReceiver.scala:18) [error] at com.twitter.finagle.stats.LoadedStatsReceiver$.(LoadedStatsReceiver.scala) [error] at com.twitter.finagle.stats.ClientStatsReceiver$.(LoadedStatsReceiver.scala:47) [error] at com.twitter.finagle.stats.ClientStatsReceiver$.(LoadedStatsReceiver.scala) [error] at com.twitter.finagle.client.StackClient$.(StackClient.scala:389) [error] at com.twitter.finagle.client.StackClient$.(StackClient.scala) [error] at com.twitter.finagle.Postgres$.com$twitter$finagle$Postgres$$defaultStack(Postgres.scala:69) [error] at com.twitter.finagle.Postgres$Client$.apply$default$1(Postgres.scala:96) [error] at com.example.finatrabasics.controllers.testSuite$.main(DbController.scala:63) [error] at com.example.finatrabasics.controllers.testSuite.main(DbController.scala)

It happens trying the example client connection you have on your quickstart page

val client = Postgres.Client()
        .withCredentials("user", Some("pass"))
        .database("mydb")
        .newRichClient("localhost:5432")

Just creating this issue in case your team would like someone succesfully using this library with newer versions of Scala.

jeremyrsmith commented 6 years ago

This looks like an issue with clashing finagle versions. We've just updated to (I think) the latest version of finagle, so that should solve this issue (assuming you're also using the latest version of finagle/finatra)