Trying to run a simulation gives error "Caused by: java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V" along with other logs

I have written a simulation for load test. I’m trying to build it in maven.

However I get the following error:

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)
at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)
Caused by: java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V

along with other logs.

My pom has the following dependencies:

io.gatling.highcharts
gatling-charts-highcharts
2.2.5


io.gatling
gatling-core
2.2.4

io.gatling gatling-maven-plugin 2.2.4 performanceTests execute simulationsPackage.SimulationClass

Please let me know if there is something i can try to build this project.

Shouldn’t be very hard to spot (took 5s to our COO, with a business degree):

io.gatling.highcharts gatling-charts-highcharts 2.2.5 io.gatling gatling-core 2.2.4

I have changed all the versions to 2.2.4. I can still see the same error.

io.gatling.highcharts gatling-charts-highcharts 2.2.4 io.gatling gatling-core 2.2.4 io.gatling gatling-maven-plugin 2.2.4 performanceTests execute simulationsPackage.SimulationClass

Thank you

I was successfully able to get past this exception.
This is how my pom now looks:

io.gatling gatling-charts 2.2.5 io.gatling gatling-core 2.2.5 net.alchim31.maven scala-maven-plugin 3.3.1 2.12.3 io.gatling gatling-maven-plugin 3.0.0-M1 performanceTests execute simulationsPackage.SimulationClass

gatling-maven-plugin 3.0.0-M1 is a milestone for FrontLine users who already use next gen Gatling 3.
Don’t use it if you use Gatling OSS, stick to stable releases.

Sure. Thanks. I have changed the gatling-maven-plugin version to 2.2.4.

But now i come across a different error:

12:50:36.313 [main][WARN ][ZincCompiler.scala:141] i.g.c.ZincCompiler$ - Pruning sources from previous analysis, due to incompatible CompileSetup.
java.lang.ClassNotFoundException: io.gatling.app.Gatling
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:42)
at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)

Please let me know if there are any leads to this kind of a compilation problem.

was able to get past this error by including the following dependency:

<dependency>
    <groupId>io.gatling</groupId>
    <artifactId>gatling-app</artifactId>
    <version>2.2.5</version>
</dependency>

Thanks,
-Harinya

Just for the records (or for other users which run into this error): I had a similar problem every now and then, when running Gatling from IntelliJ. It turned out that I had a mixture of Scala versions in my classpath. In order to compile the Gatling classes I had added Scala 2.11 to IntelliJ. When upgrading to a newer Gatling version in Maven I had forgotten about this local IntelliJ configuration. The new Gatling version required Scala 2.12 and running from the IDE didn’t work any more.