sbt plugin - java.lang.NoSuchMethodError

1,525 views
Skip to first unread message

Piotr Klubinski

unread,
Jun 28, 2017, 6:28:29 AM6/28/17
to Gatling User Group
Hi

I'm working on a POC, and researching few performance/load testing frameworks.
I gave Gatling a try, I started with using gatling.sh, and it all was working fine, requests were going out, reports were generating.
Then, in order to check how can I incorporate gatling tests into CI environment (not jenkins).
I created sbt project in IntelliJ (no scala or sbt installed on machine) based on sbt-plugin-demo, and it used to work.

Today I came back to office, wanted to make some cleanup in git, and add few steps to scenario I was working on.
And all of a sudden I started getting below error when running gatling:test

[error] Uncaught exception when running tests: java.lang.NoSuchMethodError: scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
[trace] Stack trace suppressed: run last gatling:test for the full output.
[info] Simulation(s) execution ended.
[error] Error during tests:
[error] Forked test harness failed: java.io.EOFException
[error] at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2608)
[error] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1319)
[error] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
[error] at sbt.React.react(ForkTests.scala:122)
[error] at sbt.ForkTests$$anonfun$mainTestTask$1$Acceptor$2$.run(ForkTests.scala:76)
[error] at java.lang.Thread.run(Thread.java:745)
[error] (gatling:test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 6 s, completed Jun 28, 2017 12:16:21 PM

build.sbt

name := "gatling"

version := "1.0"

scalaVersion in ThisBuild:= "2.12.2"

enablePlugins(GatlingPlugin)

scalacOptions := Seq(
"-encoding", "UTF-8", "-target:jvm-1.8", "-deprecation",
"-feature", "-unchecked", "-language:implicitConversions", "-language:postfixOps")

libraryDependencies += "io.gatling.highcharts" % "gatling-charts-highcharts" % "2.2.5" % "test,it"
libraryDependencies += "io.gatling" % "gatling-test-framework" % "2.2.5" % "test,it"

plugins.sbt

addSbtPlugin("io.gatling" % "gatling-sbt" % "2.2.1")

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "3.0.0")

my scenario:

import io.gatling.core.Predef._
import io.gatling.http.Predef._

class Login_QA extends Simulation {

val httpConf = http
.baseURL("XXX")
.inferHtmlResources()


val scn = scenario("Login")
.exec(flushSessionCookies)
.exec(http("getLogin")
.get("XXX").check(status.is(_ => 200)))
.exec(http("postLogin")
.post("XXX")
.formParam("a", "YY")
.formParam("b", "YY")
.check(status.is(_ => 200),
header("X-AJAX-LOCATION").saveAs("auth")))
.exec(http("getAuth")
.get("${auth}")
.check(status.is(_ => 200),
currentLocationRegex("XXXX")))
.exec(http("GET from REST")
.get("/").disableFollowRedirect
.resources(
http("getProfile").get("/rest/profile/").check(jsonPath("$.firstName").exists),
http("a").get("/rest/a"),
http("b").get("/rest/b"),
http("c").get("/rest/c"),
http("d").get("/rest/d"),
http("e").get("/rest/e"),
http("f").get("/rest/f"),
http("g").get("/rest/g"),
http("g").get("/rest/h")
)
)

setUp(
scn.inject(atOnceUsers(1)).protocols(httpConf)
).assertions(
global.responseTime.percentile1.lt(300)
)
}


Piotr Klubinski

unread,
Jun 28, 2017, 6:31:14 AM6/28/17
to Gatling User Group
some more output:

[IJ]> last gatling:test
[debug] javaOptions: List(-Didea.runid=c1488ea3-57c7-4d0b-8e73-4d85aa0e1132, -server, -Xmx1G, -XX:+UseG1GC, -XX:MaxGCPauseMillis=30, -XX:G1HeapRegionSize=16m, -XX:InitiatingHeapOccupancyPercent=75, -XX:+ParallelRefProcEnabled, -XX:+PerfDisableSharedMem, -XX:+AggressiveOpts, -XX:+OptimizeStringConcat, -XX:+HeapDumpOnOutOfMemoryError, -Djava.net.preferIPv4Stack=true, -Djava.net.preferIPv6Addresses=false)
[debug] Forking tests - parallelism = false
[debug] Create a single-thread test executor
[error] Uncaught exception when running tests: java.lang.NoSuchMethodError: scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
sbt.ForkMain$ForkError: java.lang.NoSuchMethodError: scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
at io.gatling.sbt.GatlingRunner.tasks(GatlingRunner.scala:30)
at sbt.ForkMain$Run.runTests(ForkMain.java:253)
at sbt.ForkMain$Run.run(ForkMain.java:139)
at sbt.ForkMain.main(ForkMain.java:121)

Stéphane LANDELLE

unread,
Jun 28, 2017, 6:36:32 AM6/28/17
to gat...@googlegroups.com
And all of a sudden I started getting below error when running gatling:test

You've forcefully upgraded from Scala 2.11 (https://github.com/gatling/gatling-sbt-plugin-demo/blob/master/build.sbt#L3) to Scala 2.12. Those are major versions that are not compatible, and Gatling 2.2 targets Scala 2.11. Gatling 3 will target Scala 2.12.

Stéphane Landelle
GatlingCorp CEO

Reply all
Reply to author
Forward
0 new messages