Runtime Error while using Play2.6

I am trying to build play2.6 scala version using maven.
play2-maven-plugin

It is compiling properly but I can’t run the application. the server seems to be up

[debug] a.i.TcpListener - Successfully bound to /0:0:0:0:0:0:0:0:9000
[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
ncaught error from thread [application-akka.actor.default-dispatcher-4]: play.core.server.AkkaHttpServer$$anon$3.reloadDebugInfo(Lscala/util/Try;Lplay/core/server/ServerProvider;)Lscala/Option;, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[application]
java.lang.NoSuchMethodError: play.core.server.AkkaHttpServer$$anon$3.reloadDebugInfo(Lscala/util/Try;Lplay/core/server/ServerProvider;)Lscala/Option;
	at play.core.server.AkkaHttpServer$$anon$3.reloadValue(AkkaHttpServer.scala:211)
	at play.core.server.AkkaHttpServer$$anon$3.reloadValue(AkkaHttpServer.scala:199)
	at play.core.server.common.ReloadCache.$anonfun$reloadCache$1(ReloadCache.scala:25)
	at play.utils.InlineCache.fresh(InlineCache.scala:69)
	at play.utils.InlineCache.apply(InlineCache.scala:55)
	at play.core.server.common.ReloadCache.cachedFrom(ReloadCache.scala:31)

I’m getting the above error.

the same application is working fine if I am building using sbt.
Any Ideas why?

This looks like a jar dependency conflict. From the stack, it means that there are two jars that include the method play.core.server.AkkaHttpServer$$anon$3.reloadDebugInfo with different signatures, and your build tool happens to choose the JAR with the method’s signature that you don’t want and evict the jar that you want.

Here are the steps I usually do to resolve the issue:

  1. Identify which jar contains play.core.server.AkkaHttpServer$$anon$3.reloadDebugInfo.
  2. Print the full dependency tree (including indirect dependencies) to see how many versions of that jar is included. For example, for sbt, we can use https://github.com/jrudolph/sbt-dependency-graph. I’m not sure why sbt doesn’t support this feature natively.
  3. Try to get all the jar to be on the same version (or a set of versions that are, at least, compatible with each other) by changing the versions of your direct dependencies.

the same application is working fine if I am building using sbt.

It could be that sbt happens to choose the jar that has the method’s signature that you want.

1 Like

thank you @tanin47 I got lucky; by changing the scala version to 2.11.12 and using all the jars for _2.11 eg:play-json_2.11 I got it to work.

2 Likes