Error in Gatling maven plugin

paul picture paul · Apr 20, 2017 · Viewed 8k times · Source

I´m using gatling-maven-plugin to run some Performance test. I just follow the official documentation http://gatling.io/docs/2.2/extensions/maven_plugin/

I have this configuration

<!--PERFORMANCE TEST-->
        <plugin>
            <groupId>io.gatling</groupId>
            <artifactId>gatling-maven-plugin</artifactId>
            <version>2.2.4</version>
            <configuration>
                <!--<disableCompiler>true</disableCompiler>-->
                <configFolder>${project.basedir}/src/test/resources</configFolder>
                <dataFolder>${project.basedir}/src/test/resources/data</dataFolder>
                <resultsFolder>${project.basedir}/target/gatling/results</resultsFolder>
                <bodiesFolder>${project.basedir}/src/test/resources/bodies</bodiesFolder>
                <simulationsFolder>${project.basedir}/src/test/scala/performance/</simulationsFolder>
                <runDescription>This-is-the-run-description</runDescription>
                <simulationClass>${project.basedir}\src\test\scala\performance\TillScenario</simulationClass>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>integration-test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>

it´s complaining because

error: java.lang.NoClassDefFoundError: scala/reflect/internal/AnnotationInfos$ErroneousAnnotation$
        at scala.tools.nsc.typechecker.Typers$class.newTyper(Typers.scala:100)
        at scala.tools.nsc.Global$$anon$1.newTyper(Global.scala:463)
        at scala.tools.nsc.typechecker.Namers$Namer.<init>(Namers.scala:58)
        at scala.tools.nsc.typechecker.Namers$NormalNamer.<init>(Namers.scala:50)
        at scala.tools.nsc.typechecker.Namers$class.newNamer(Namers.scala:51)
        at scala.tools.nsc.Global$$anon$1.newNamer(Global.scala:463)
        at scala.tools.nsc.typechecker.Analyzer$namerFactory$$anon$1.apply(Analyzer.scala:43)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:441)
        at scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:432)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:441)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:399)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:399)
        at scala.collection.Iterator$class.foreach(Iterator.scala:750)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1202)
        at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:399)
        at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1500)
        at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1487)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:1482)
        at scala.tools.nsc.Global$Run.compile(Global.scala:1580)
        at scala.tools.nsc.Driver.doCompile(Driver.scala:32)
        at scala.tools.nsc.MainClass.doCompile(Main.scala:23)
        at scala.tools.nsc.Driver.process(Driver.scala:51)
        at scala.tools.nsc.Main.process(Main.scala)
        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:497)
        at sbt.compiler.RawCompiler.apply(RawCompiler.scala:33)
        at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1$$anonfun$apply$2.apply(AnalyzingCompiler.scala:146)
        at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1$$anonfun$apply$2.apply(AnalyzingCompiler.scala:142)
        at sbt.IO$.withTemporaryDirectory(IO.scala:344)
        at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1.apply(AnalyzingCompiler.scala:142)
        at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1.apply(AnalyzingCompiler.scala:139)
        at sbt.IO$.withTemporaryDirectory(IO.scala:344)
        at sbt.compiler.AnalyzingCompiler$.compileSources(AnalyzingCompiler.scala:139)
        at sbt.compiler.IC$.compileInterfaceJar(IncrementalCompiler.scala:58)
        at com.typesafe.zinc.Compiler$.compilerInterface(Compiler.scala:148)
        at com.typesafe.zinc.Compiler$.create(Compiler.scala:53)
        at io.gatling.compiler.ZincCompiler$delayedInit$body.apply(ZincCompiler.scala:147)
        at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App$$anonfun$main$1.apply(App.scala:71)
        at scala.App$$anonfun$main$1.apply(App.scala:71)
        at scala.collection.immutable.List.foreach(List.scala:318)
        at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
        at scala.App$class.main(App.scala:71)
        at io.gatling.compiler.ZincCompiler$.main(ZincCompiler.scala:36)
        at io.gatling.compiler.ZincCompiler.main(ZincCompiler.scala)
        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:497)
        at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)
        at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)
Caused by: java.lang.ClassNotFoundException: scala.reflect.internal.AnnotationInfos$ErroneousAnnotation$
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 54 more

And If I add this line in the configuration

<disableCompiler>true</disableCompiler>

it´s complaint because cannot find the my simulationClass

Caused by: java.lang.IllegalArgumentException: The requested class 'path\TillScenario' can not be found in the classpath or does not extends Simulation.

Any idea what I´m doing wrong?

Answer

Bianca Tesila picture Bianca Tesila · Apr 20, 2017

Not sure whether you have added the Scala Maven Plugin or not after disabling the gatling-maven-plugin, but this might explain the second error, as described here. You should compile your Simulation classes somehow, either via the Gatling plugin or the Scala plugin.

As for the first error, it looks like a dependency mismatch issue. Make sure you are using the binary compatible versions of Gatling dependencies as well as Scala ones.

I hope this is helpful.