Gatling 和 Scala 和 Java JDK 有 严格的版本兼容问题。碰到兼容问题时一般也很难排查。

在这里列了一些自己遇到的问题和 正在使用的版本。希望对大家有所帮助

Gatling 2.3.1 对应的 Scala SDK 版本 2.11.8
Gatling 3.2.0 对应的 Scala SDK 版本 2.12.4

Scala sdk 下载地址:https://www.scala-lang.org/download/

版本不匹配报错信息:

Exception in thread "main" java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V
    at akka.util.Timeout.<init>(Timeout.scala:13)
    at akka.actor.ActorSystem$Settings.<init>(ActorSystem.scala:329)
    at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:667)
    at akka.actor.ActorSystem$.apply(ActorSystem.scala:246)
    at akka.actor.ActorSystem$.apply(ActorSystem.scala:289)
    at akka.actor.ActorSystem$.apply(ActorSystem.scala:234)
    at com.akka.test.Hello1$.delayedEndpoint$com$akka$test$Hello1$1(Hello1.scala:12)
    at com.akka.test.Hello1$delayedInit$body.apply(Hello1.scala:10)
    at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at scala.App$$anonfun$main$1.apply(App.scala:76)
    at scala.App$$anonfun$main$1.apply(App.scala:76)
    at scala.collection.immutable.List.foreach(List.scala:392)
    at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
    at scala.App$class.main(App.scala:76)
    at com.akka.test.Hello1$.main(Hello1.scala:10)
    at com.akka.test.Hello1.main(Hello1.scala

Scala 版本太高报错信息:

Error:(11, 18) illegal cyclic inheritance involving trait Iterable
Gatling.fromMap(props.build)
Error:(11, 26) illegal cyclic inheritance involving trait Map
GatlingRecorder.fromMap(props.build, Some(IDEPathHelper.recorderConfigFile))
Error:(10, 9) illegal cyclic inheritance involving trait Iterable
val scn = scenario("SpringBootSimulation").during(100){
Error:(15, 10) illegal cyclic inheritance involving class List
setUp(scn.inject(atOnceUsers(10)).protocols(httpConf))


↙↙↙阅读原文可查看相关链接,并与作者交流