Unable to use Gatling with Play version 2. 6 upwards.

Hi

I have gatling project within Scala Play project and was able to run Gatling tests with Play scala version: 2.5.4. I get the error below when upgraded to 2.5.6 upwards. I did dependency tree comparison for play version 2.5.4 and 2.56 and found out it’s down to the version of the HTTP async client - see below. One option to solve this is to separate the gatling project from the play scala project, but I find this really annoying. Any suggestions would be really appreciated.

Regards,

Ayache

dependencies version details

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.11")
"io.gatling.highcharts" % "gatling-charts-highcharts" % "2.2.2" % Test,
"io.gatling" % "gatling-test-framework" % "2.2.2" % Test,

Play 2.5.6 upwards

±org.asynchttpclient:async-http-client:2.0.24e[0m
e[0m[e[0minfoe[0m] e[0m | ±com.typesafe.netty:netty-reactive-streams:1.0.8e[0m
e[0m[e[0minfoe[0m] e[0m | | ±io.netty:netty-handler:4.0.41.Final (evicted by: 4.0.42.Final)e[0m
e[0m[e[0minfoe[0m] e[0m | | | ±io.netty:netty-buffer:4.0.41.Final (evicted by: 4.0.42.Final)e[0m
e[0m[e[0minfoe[0m] e[0m | | | | ±io.netty:netty-common:4.0.41.Final (evicted by: 4.0.42.Final)e[0m
e[0m[e[0minfoe[0m] e[0m | | | | ±io.netty:netty-common:4.0.42.Finale[0m
e[0m[e[0minfoe[0m] e[0m | | | | e[0m
e[0m[e[0minfoe[0m] e[0m | | | ±io.netty:netty-buffer:4.0.42.Finale[0m

Play 2.4.5

±org.asynchttpclient:async-http-client:2.0.2e[0m
e[0m[e[0minfoe[0m] e[0m | ±com.typesafe.netty:netty-reactive-streams:1.0.4 (evicted by: 1.0.6)e[0m

Uncaught exception when running gatling.simulation.ReturnRequestPerformanceTest: java.lang.NoSuchMethodError: org.asynchttpclient.netty.channel.DefaultChannelPool.(IILio/netty/util/Timer;)V
sbt.ForkMain$ForkError: java.lang.NoSuchMethodError: org.asynchttpclient.netty.channel.DefaultChannelPool.(IILio/netty/util/Timer;)V
at io.gatling.http.ahc.DefaultAhcFactory.newChannelPool(AhcFactory.scala:84)
at io.gatling.http.ahc.DefaultAhcFactory.(AhcFactory.scala:143)
at io.gatling.http.ahc.AhcFactory$.apply(AhcFactory.scala:46)
at io.gatling.http.ahc.HttpEngine$.apply(HttpEngine.scala:40)
at io.gatling.http.protocol.HttpProtocol$$anon$1.newComponents(HttpProtocol.scala:52)
at io.gatling.core.protocol.ProtocolComponentsRegistry.io$gatling$core$protocol$ProtocolComponentsRegistry$$$anonfun$1(Protocol.scala:57)
at io.gatling.core.protocol.ProtocolComponentsRegistry$lambda$$componentsFactory$1$1.apply(Protocol.scala:57)
at io.gatling.core.protocol.ProtocolComponentsRegistry$lambda$$componentsFactory$1$1.apply(Protocol.scala:57)
at scala.collection.mutable.MapLike$class.getOrElseUpdate(MapLike.scala:194)
at scala.collection.mutable.AbstractMap.getOrElseUpdate(Map.scala:80)
at io.gatling.core.protocol.ProtocolComponentsRegistry.componentsFactory$1(Protocol.scala:57)
at io.gatling.core.protocol.ProtocolComponentsRegistry.comps$1(Protocol.scala:59)
at io.gatling.core.protocol.ProtocolComponentsRegistry.io$gatling$core$protocol$ProtocolComponentsRegistry$$$anonfun$4(Protocol.scala:61)
at io.gatling.core.protocol.ProtocolComponentsRegistry$lambda$$components$1.apply(Protocol.scala:61)
at scala.collection.mutable.MapLike$class.getOrElseUpdate(MapLike.scala:194)
at scala.collection.mutable.AbstractMap.getOrElseUpdate(Map.scala:80)
at io.gatling.core.protocol.ProtocolComponentsRegistry.components(Protocol.scala:61)
at io.gatling.http.action.HttpActionBuilder.lookUpHttpComponents(HttpActionBuilder.scala:25)
at io.gatling.http.action.sync.HttpRequestActionBuilder.build(HttpRequestActionBuilder.scala:33)
at io.gatling.core.structure.StructureBuilder$class.io$gatling$core$structure$StructureBuilder$class$$$anonfun$1(StructureBuilder.scala:34)
at io.gatling.core.structure.StructureBuilder$class$lambda$$build$1.apply(StructureBuilder.scala:33)
at io.gatling.core.structure.StructureBuilder$class$lambda$$build$1.apply(StructureBuilder.scala:33)
at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:124)
at scala.collection.immutable.List.foldLeft(List.scala:84)
at io.gatling.core.structure.StructureBuilder$class.build(StructureBuilder.scala:33)
at io.gatling.core.structure.ChainBuilder.build(ChainBuilder.scala:30)
at io.gatling.core.action.builder.TryMaxBuilder.build(TryMaxBuilder.scala:26)
at io.gatling.core.structure.StructureBuilder$class.io$gatling$core$structure$StructureBuilder$class$$$anonfun$1(StructureBuilder.scala:34)
at io.gatling.core.structure.StructureBuilder$class$lambda$$build$1.apply(StructureBuilder.scala:33)
at io.gatling.core.structure.StructureBuilder$class$lambda$$build$1.apply(StructureBuilder.scala:33)
at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:124)
at scala.collection.immutable.List.foldLeft(List.scala:84)
at io.gatling.core.structure.StructureBuilder$class.build(StructureBuilder.scala:33)
at io.gatling.core.structure.ScenarioBuilder.build(ScenarioBuilder.scala:38)
at io.gatling.core.structure.PopulationBuilder.build(ScenarioBuilder.scala:101)
at io.gatling.core.scenario.SimulationParams.io$gatling$core$scenario$SimulationParams$$$anonfun$13(Simulation.scala:169)
at io.gatling.core.scenario.SimulationParams$lambda$$scenarios$1.apply(Simulation.scala:169)
at io.gatling.core.scenario.SimulationParams$lambda$$scenarios$1.apply(Simulation.scala:169)
at scala.collection.immutable.List.map(List.scala:273)
at io.gatling.core.scenario.SimulationParams.scenarios(Simulation.scala:169)
at io.gatling.app.Gatling.run(Gatling.scala:102)
at io.gatling.app.Gatling.runIfNecessary(Gatling.scala:75)
at io.gatling.app.Gatling.start(Gatling.scala:65)
at io.gatling.app.Gatling$.start(Gatling.scala:57)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:49)
at io.gatling.sbt.GatlingTask.liftedTree1$1(GatlingTask.scala:51)
at io.gatling.sbt.GatlingTask.execute(GatlingTask.scala:50)
at sbt.ForkMain$Run$2.call(ForkMain.java:296)
at sbt.ForkMain$Run$2.call(ForkMain.java:286)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[info] Simulation(s) execution ended.

Atm, there’s no other solution than to split into 2 projects so Gatling and Play! classpaths don’t clash.

Will has just made it so that future versions of Play! will use a shaded version of AHC and AHC’s Netty dependency:

https://twitter.com/will_sargent/status/823274467099111424

https://twitter.com/will_sargent/status/823309550329569280

Many thanks Stephane for clarification.

Ayache