[2.4.0-scala] Guice configuration error NingWSPlugin

754 views
Skip to first unread message

Paul Dijou

unread,
Jun 3, 2015, 4:47:53 AM6/3/15
to play-fr...@googlegroups.com
I just tried to upgrade my lib to Play 2.4 and it works fine except for integration tests that are now failing for a strange reason... Those tests have been written following this documentation

Exception encountered when attempting to run a suite with class name: pdi.jwt.JwtSessionSpec *** ABORTED ***
  com
.google.inject.ConfigurationException: Guice configuration errors:


1) Could not find a suitable constructor in play.api.libs.ws.ning.NingWSPlugin. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
  at play
.api.libs.ws.ning.NingWSPlugin.class(NingWS.scala:490)
 
while locating play.api.libs.ws.ning.NingWSPlugin


1 error
  at com
.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1042)
  at com
.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1001)
  at com
.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
  at play
.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:321)
  at play
.api.Plugins$$anonfun$loadPlugins$1.apply(Plugins.scala:89)
  at play
.api.Plugins$$anonfun$loadPlugins$1.apply(Plugins.scala:87)
  at scala
.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
  at scala
.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
  at scala
.collection.immutable.List.foreach(List.scala:381)
  at scala
.collection.TraversableLike$class.map(TraversableLike.scala:245)

James suggested it might be because of a pre 2.4 play-ws version in the classpath but the project never had any dependencies to WS to begin with. It's just a small Scala lib to handle JWT inside HTTP headers. I don't even know why the FakeApplication is trying to use WS at all... I tried to clean as much as possible and it didn't change anything.

Full code of the test is on Github and you can run playEdge/test inside sbt to reproduce if necessary.

Thanks for any help.

Paul Dijou

unread,
Jun 8, 2015, 4:58:27 AM6/8/15
to play-fr...@googlegroups.com
Didn't gave up yet... I finally tried to add a test dependency to play-ws 2.4.0, which is kind of ugly but who knows, right? Now my tests don't even compile. I tried to do a full rebuild, nothing changed. I tried to add "-Ylog-classpath", but couldn't find anything wrong among all the logs. I don't really understand how adding the WS dependency and not using it at all could break the compilation but here it is.

[error] missing or invalid dependency detected while loading class file 'WsScalaTestClient.class'.
[error] Could not access type WSRequestHolder in object play.api.libs.ws.WS,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'WsScalaTestClient.class' was compiled against an incompatible version of play.api.libs.ws.WS.
[error] one error found
[error] (playEdge/test:compileIncremental) Compilation failed
[error] Total time: 9 s, completed 8/06/2015 10:42:56 AM

Will Sargent

unread,
Jun 8, 2015, 8:57:55 AM6/8/15
to play-fr...@googlegroups.com
WSRequestHolder was removed from Play 2.4.0, per the migration notes:


Do you have a reference to any Play 2.3.x code in your project?  I cloned it from the repo, but couldn't compile it because of unresolved dependencies:

[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] ::          UNRESOLVED DEPENDENCIES         ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.tpolecat#tut-plugin;0.3.2: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn] org.tpolecat:tut-plugin:0.3.2 (scalaVersion=2.10, sbtVersion=0.13)
[warn]
[warn] Note: Unresolved dependencies path:
[warn] org.tpolecat:tut-plugin:0.3.2 (scalaVersion=2.10, sbtVersion=0.13) (/Users/wsargent/work/jwt-scala/project/plugins.sbt#L13-14)
[warn]  +- default:jwt-scala-build:0.1-SNAPSHOT (scalaVersion=2.10, sbtVersion=0.13)
sbt.ResolveException: unresolved dependency: org.tpolecat#tut-plugin;0.3.2: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:291)



--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/16b9099a-d57e-4576-a413-feea5c4455f7%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Paul Dijou

unread,
Jun 8, 2015, 10:01:10 AM6/8/15
to play-fr...@googlegroups.com
Thanks a lot for your concern. First, my bad, looks like I did forget to add the resolver for the tut plugin (I hate my cache sometimes...).

As for the other problem, I went deeper with the help of a friend and he found that ScalaTestPlusPlay actually rely on play-ws, version 2.3.0 of course, which caused the problem. Need to wait for this PR to be finished : https://github.com/scalatest/scalatestplus-play/pull/16

Xiaofeng Lin

unread,
Aug 21, 2015, 2:12:31 PM8/21/15
to play-framework
I hit the exact same error when tried to migrate from play 2.3.9 to 2.4.2.  Thanks for your hint. But you don't need to wait until the issue is fully resolved. Change scalatestplus from 1.2.0 to 1.4.0-M4 seems to fix the problem.
...
"org.scalatestplus" %% "play" % "1.4.0-M4" % "test",
...
Reply all
Reply to author
Forward
0 new messages