New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.4.0-RC1 play-scala-intro: ProvisionException - Error injecting constructor #4342

Closed
johdah opened this Issue Apr 30, 2015 · 6 comments

Comments

Projects
None yet
5 participants
@johdah

johdah commented Apr 30, 2015

I am not sure if this is the place to report it but since the play-scala-intro template is in this repo.

I get the following error when I try to run the play-scala-intro template:

[info] Application should
[error]   ! work from within a browser
[error]    com.google.inject.ProvisionException: Guice provision errors:
[error]
[error]    1) Error injecting constructor, scala.tools.reflect.ToolBoxError: reflective compilation has failed: cannot i
nitialize the compiler due to java.lang.VerifyError: scala/tools/reflect/ToolBoxFactory$ToolBoxImpl$ToolBoxGlobal
[error]      at models.DB.<init>(Unknown Source)
[error]      while locating models.DB
[error]        for parameter 0 at controllers.Application.<init>(Unknown Source)
[error]      while locating controllers.Application
[error]        for parameter 1 at router.Routes.<init>(Unknown Source)
[error]      while locating router.Routes
[error]      while locating play.api.test.FakeRouterProvider
[error]      while locating play.api.routing.Router
[error]
[error]    1 error (TestServer.scala:46)
[error] play.api.test.TestServer.start(TestServer.scala:46)
[error] play.api.test.PlayRunners$class.running(Helpers.scala:55)
[error] play.api.test.Helpers$.running(Helpers.scala:363)
[error] play.api.test.WithBrowser.around(Specs.scala:89)
[error] play.api.test.WithBrowser.delayedInit(Specs.scala:72)
[error] IntegrationSpec$$anonfun$1$$anonfun$apply$1$$anon$1.<init>(IntegrationSpec.scala:16)
[error] IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:16)
[error] IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:16)
[error] com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:987)
[error] com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1013)
[error] play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:314)
[error] play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:309)
[error] play.api.Application$class.routes(Application.scala:111)
[error] play.api.test.FakeApplication.routes(Fakes.scala:197)
[error] play.api.Play$.start(Play.scala:89)
...

@benmccann benmccann added this to the 2.4.0 milestone May 1, 2015

@jroper

This comment has been minimized.

Show comment
Hide comment
@jroper

jroper May 1, 2015

Member

The play-scala-intro template is known to have issues, we disabled our build for it a while ago, there seemed to be some problems in sorm that we couldn't work out. Since it's talking about reflective compilation, I guess this is a sorm problem? I'm not sure.

What version of Scala are you using?

Member

jroper commented May 1, 2015

The play-scala-intro template is known to have issues, we disabled our build for it a while ago, there seemed to be some problems in sorm that we couldn't work out. Since it's talking about reflective compilation, I guess this is a sorm problem? I'm not sure.

What version of Scala are you using?

@johdah

This comment has been minimized.

Show comment
Hide comment
@johdah

johdah commented May 1, 2015

2.11.6

@marcospereira

This comment has been minimized.

Show comment
Hide comment
@marcospereira

marcospereira May 1, 2015

Member

I can confirm the problem using the configuration below:

// build.sbt
name := "play-scala-intro"

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.11.6"

resolvers += "sorm Scala 2.11 fork" at "http://markusjura.github.io/sorm"

resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"

libraryDependencies ++= Seq(  
  "org.sorm-framework" % "sorm" % "0.4.1",
  "com.h2database" % "h2" % "1.4.187",
  specs2 % Test
)     

// Play provides two styles of routers, one expects its actions to be injected, the
// other, legacy style, accesses its actions statically.
routesGenerator := InjectedRoutesGenerator
// project/plugins.sbt
resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.0-RC1")

// web plugins

addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.2")

Generates the following error (when executing activator clean run):

ProvisionException: Guice provision errors:

1) Error injecting constructor, scala.tools.reflect.ToolBoxError: reflective compilation has failed: cannot initialize the compiler due to java.lang.VerifyError: scala/tools/reflect/ToolBoxFactory$ToolBoxImpl$ToolBoxGlobal
  at models.DB.<init>(Unknown Source)
  while locating models.DB
    for parameter 0 at controllers.Application.<init>(Unknown Source)
  while locating controllers.Application
    for parameter 1 at router.Routes.<init>(Unknown Source)
  while locating router.Routes
  while locating play.api.inject.RoutesProvider
  while locating play.api.routing.Router

1 error

The sorm version used at that template is not even the official version. I think we should rewrite it to use another persistence engine, maybe anorm or slick.

@jroper, what do you think?

Member

marcospereira commented May 1, 2015

I can confirm the problem using the configuration below:

// build.sbt
name := "play-scala-intro"

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.11.6"

resolvers += "sorm Scala 2.11 fork" at "http://markusjura.github.io/sorm"

resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"

libraryDependencies ++= Seq(  
  "org.sorm-framework" % "sorm" % "0.4.1",
  "com.h2database" % "h2" % "1.4.187",
  specs2 % Test
)     

// Play provides two styles of routers, one expects its actions to be injected, the
// other, legacy style, accesses its actions statically.
routesGenerator := InjectedRoutesGenerator
// project/plugins.sbt
resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.0-RC1")

// web plugins

addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.2")

Generates the following error (when executing activator clean run):

ProvisionException: Guice provision errors:

1) Error injecting constructor, scala.tools.reflect.ToolBoxError: reflective compilation has failed: cannot initialize the compiler due to java.lang.VerifyError: scala/tools/reflect/ToolBoxFactory$ToolBoxImpl$ToolBoxGlobal
  at models.DB.<init>(Unknown Source)
  while locating models.DB
    for parameter 0 at controllers.Application.<init>(Unknown Source)
  while locating controllers.Application
    for parameter 1 at router.Routes.<init>(Unknown Source)
  while locating router.Routes
  while locating play.api.inject.RoutesProvider
  while locating play.api.routing.Router

1 error

The sorm version used at that template is not even the official version. I think we should rewrite it to use another persistence engine, maybe anorm or slick.

@jroper, what do you think?

@dotta

This comment has been minimized.

Show comment
Hide comment
@dotta

dotta May 4, 2015

Contributor

Using "org.sorm-framework" % "sorm" % "0.3.18" (the recommended latest supported version) also doesn't work. It throws up a different exception:

Caused by: java.lang.NoSuchMethodError: scala.reflect.api.Types$TypeApi.members()Lscala/reflect/api/Scopes$ScopeApi;
    at sorm.reflection.ScalaApi$TypeApi.members(ScalaApi.scala:11) ~[sorm-0.3.15.jar:na]

I believe what's happening is that sorm is compiled against Scala 2.10, and not cross-compiled against both Scala 2.10 and Scala 2.11. So, despite what the sorm authors are saying on the github project's page, I don't think they are supporting Scala 2.11.

I agree with @marcospereira, we should drop using sorm and use something else.

Contributor

dotta commented May 4, 2015

Using "org.sorm-framework" % "sorm" % "0.3.18" (the recommended latest supported version) also doesn't work. It throws up a different exception:

Caused by: java.lang.NoSuchMethodError: scala.reflect.api.Types$TypeApi.members()Lscala/reflect/api/Scopes$ScopeApi;
    at sorm.reflection.ScalaApi$TypeApi.members(ScalaApi.scala:11) ~[sorm-0.3.15.jar:na]

I believe what's happening is that sorm is compiled against Scala 2.10, and not cross-compiled against both Scala 2.10 and Scala 2.11. So, despite what the sorm authors are saying on the github project's page, I don't think they are supporting Scala 2.11.

I agree with @marcospereira, we should drop using sorm and use something else.

@marcospereira

This comment has been minimized.

Show comment
Hide comment
@marcospereira

marcospereira May 4, 2015

Member

Yep. Perhaps we can just remove that template since we already have templates for anorm and slick:

  1. Anorm: https://www.typesafe.com/activator/template/computer-database-scala
  2. Slick: https://www.typesafe.com/activator/template/play-slick-quickstart

Or maybe anorm and play-slick projects could provide the templates themselves instead. Looks like play-slick is already there.

Member

marcospereira commented May 4, 2015

Yep. Perhaps we can just remove that template since we already have templates for anorm and slick:

  1. Anorm: https://www.typesafe.com/activator/template/computer-database-scala
  2. Slick: https://www.typesafe.com/activator/template/play-slick-quickstart

Or maybe anorm and play-slick projects could provide the templates themselves instead. Looks like play-slick is already there.

@jroper jroper modified the milestone: 2.4.0 Jun 18, 2015

@marcospereira

This comment has been minimized.

Show comment
Hide comment
@marcospereira

marcospereira Jul 30, 2015

Member

Closing since play-scala-intro is now using play-slick (see fcb94e6).

Member

marcospereira commented Jul 30, 2015

Closing since play-scala-intro is now using play-slick (see fcb94e6).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment