Search code examples
scalasbtgatling

Unable to run the gatling test (jvm issue)


I am trying to run the gatling test on MacOS. Java version: openjdk version "1.8.0_275" scala version: 2.12.12 sbt version :1.4.4

I am unable to run my tests because of this error. I have tried changing the java versions(recommended one) and tried reinstalling the sbt as well.

The error log is as follows:

Unrecognized VM option 'AggressiveOpts'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
[error] Could not accept connection from test agent: class java.net.SocketException: Socket closed
[error] java.net.SocketException: Socket closed
[error]         at java.base/sun.nio.ch.NioSocketImpl.endAccept(NioSocketImpl.java:689)
[error]         at java.base/sun.nio.ch.NioSocketImpl.accept(NioSocketImpl.java:762)
[error]         at java.base/java.net.ServerSocket.implAccept(ServerSocket.java:684)
[error]         at java.base/java.net.ServerSocket.platformImplAccept(ServerSocket.java:650)
[error]         at java.base/java.net.ServerSocket.implAccept(ServerSocket.java:626)
[error]         at java.base/java.net.ServerSocket.implAccept(ServerSocket.java:583)
[error]         at java.base/java.net.ServerSocket.accept(ServerSocket.java:540)
[error]         at sbt.ForkTests$Acceptor$1$.run(ForkTests.scala:71)
[error]         at java.base/java.lang.Thread.run(Thread.java:832)

I would appreciate your feedback on this. Thank you.


Solution

  • There's no way you're using Java 8 as indicated, as your stacktrace clearly shows Jigsaw modules (java.base/). You're using Java 9 or older.

    What happens is that the test forked JVM crashes on boot because it's being passed the AggressiveOpts option that was dropped after Java 8.

    This option was removed in recent versions of Gatling's sbt plugin, meaning that you're using an older version.

    In short: update your sbt plugin version.