gatling with maven

284 views
Skip to first unread message

Paul Reicherzer

unread,
Feb 14, 2017, 4:00:53 AM2/14/17
to Gatling User Group
Hey folks,

I'm struggling with gatling and maven.
This is my testclass "SendNotificationsWithManyUnknownSubscribers" laying in src/test/gatlingTest:
package gatlingTest

import io.gatling.core.Predef._
import io.gatling.http.Predef._
class SendNotificationsWithManyUnknownSubscribers extends Simulation {

 
val httpConf = http
   
.baseURL("http://www.google.de")

 
val scn = scenario("SendNotificationsWithManyUnknownSubscribers")
     
.exec(http("Get auf google")
         
.get("/"))

  setUp
(scn.inject(atOnceUsers(1)).protocols(httpConf))
}

My maven configuration:
<plugin>
   
<groupId>io.gatling</groupId>
   
<artifactId>gatling-maven-plugin</artifactId>
   
<version>2.2.1</version>
   
<configuration>
        <simulationsFolder>src/test/gatlingTest</simulationsFolder>
       
<simulationClass>SendNotificationsWithManyUnknownSubscribers</simulationClass>
   
</configuration>
   
<executions>
       
<execution>
           
<goals>
               
<goal>integration-test</goal>
           
</goals>
       
</execution>
   
</executions>
</plugin>

If I ran the maven task with
mvn clean install gatling:integration-test

It produces 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:497)
    at io
.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)
    at io
.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)
Caused by: java.lang.IllegalArgumentException: The requested class 'SendNotificationsWithManyUnknownSubscribers' can not be found in the classpath or does not extends Simulation.
    at io
.gatling.app.Selection$Selector.io$gatling$app$Selection$Selector$$$anonfun$6(Selection.scala:80)
    at io
.gatling.app.Selection$Selector$$Lambda$31/460741164.apply(Unknown Source)
    at scala
.Option.flatMap(Option.scala:171)
    at io
.gatling.app.Selection$Selector.singleSimulationFromConfig$1(Selection.scala:73)
    at io
.gatling.app.Selection$Selector.io$gatling$app$Selection$Selector$$$anonfun$8(Selection.scala:97)
    at io
.gatling.app.Selection$Selector$$Lambda$30/1896074070.apply(Unknown Source)
    at scala
.Option.orElse(Option.scala:289)
    at io
.gatling.app.Selection$Selector.trySelectingSingleSimulation(Selection.scala:97)
    at io
.gatling.app.Selection$Selector.selection(Selection.scala:40)
    at io
.gatling.app.Selection$.apply(Selection.scala:33)
    at io
.gatling.app.Runner.run0(Runner.scala:78)
    at io
.gatling.app.Runner.run(Runner.scala:64)
    at io
.gatling.app.Gatling$.start(Gatling.scala:56)
    at io
.gatling.app.Gatling$.fromArgs(Gatling.scala:41)
    at io
.gatling.app.Gatling$.main(Gatling.scala:33)
    at io
.gatling.app.Gatling.main(Gatling.scala)
   
... 6 more

I've tried everything trying to find the Simulationclass via the configuration but nothing helped.
Do you have any ideas?

Barry Perez

unread,
Feb 14, 2017, 4:15:05 AM2/14/17
to Gatling User Group

How about like this? It find the simulation file if you include the package name in the simulationClass?

    <configuration>
        <simulationsFolder>src/test</simulationsFolder>
        <simulationClass>gatlingTest.SendNotificationsWithManyUnknownSubscribers</simulationClass>
    </configuration>

Paul Reicherzer

unread,
Feb 14, 2017, 4:20:17 AM2/14/17
to Gatling User Group
Doing this lets crash the ZincCompiler:
10:18:43.658 [main][ERROR][ZincCompiler.scala:156] i.g.c.ZincCompiler$ - Compilation crashed
java
.io.IOException: CreateProcess error=2, Das System kann die angegebene Datei nicht finden (System cannot find File...)
    at java
.lang.ProcessImpl.create(Native Method)
    at java
.lang.ProcessImpl.<init>(ProcessImpl.java:386)
    at java
.lang.ProcessImpl.start(ProcessImpl.java:137)
    at java
.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
   
... 67 common frames omitted
Wrapped by: java.io.IOException: Cannot run program "javac": CreateProcess error=2, Das System kann die angegebene Datei nicht finden
    at java
.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at sbt
.SimpleProcessBuilder.run(ProcessImpl.scala:349)
    at sbt
.AbstractProcessBuilder.run(ProcessImpl.scala:128)
    at sbt
.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.scala:159)
    at sbt
.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.scala:159)
    at sbt
.compiler.JavacLogger.buffer(AggressiveCompile.scala:237)
    at sbt
.AbstractProcessBuilder.runBuffered(ProcessImpl.scala:159)
    at sbt
.AbstractProcessBuilder.$bang(ProcessImpl.scala:156)
    at sbt
.compiler.AggressiveCompile$$anonfun$forkJavac$1.apply(AggressiveCompile.scala:215)
    at sbt
.compiler.AggressiveCompile$$anonfun$forkJavac$1.apply(AggressiveCompile.scala:210)
    at sbt
.compiler.JavaCompiler$$anonfun$forkJavac$1.sbt$compiler$JavaCompiler$$anonfun$$externalJavac$1(JavaCompiler.scala:122)
    at sbt
.compiler.JavaCompiler$$anonfun$forkJavac$1$$anonfun$apply$2.apply(JavaCompiler.scala:123)
    at sbt
.compiler.JavaCompiler$$anonfun$forkJavac$1$$anonfun$apply$2.apply(JavaCompiler.scala:123)
    at sbt
.compiler.JavaCompiler$$anonfun$withArgumentFile$1.apply(JavaCompiler.scala:152)
    at sbt
.compiler.JavaCompiler$$anonfun$withArgumentFile$1.apply(JavaCompiler.scala:149)
    at sbt
.IO$.withTemporaryDirectory(IO.scala:291)
    at sbt
.compiler.JavaCompiler$.withArgumentFile(JavaCompiler.scala:149)
    at sbt
.compiler.JavaCompiler$$anonfun$forkJavac$1.apply(JavaCompiler.scala:123)
    at sbt
.compiler.JavaCompiler$$anonfun$forkJavac$1.apply(JavaCompiler.scala:118)
    at sbt
.compiler.JavaCompiler$$anonfun$directOrForkJavac$1.apply(JavaCompiler.scala:114)
    at sbt
.compiler.JavaCompiler$$anonfun$directOrForkJavac$1.apply(JavaCompiler.scala:109)
    at sbt
.compiler.JavaCompiler$JavaTool0.compile(JavaCompiler.scala:95)
    at sbt
.compiler.JavaTool$class.apply(JavaCompiler.scala:54)
    at sbt
.compiler.JavaCompiler$JavaTool0.apply(JavaCompiler.scala:84)
    at sbt
.compiler.JavaCompiler$class.compile(JavaCompiler.scala:35)
    at sbt
.compiler.JavaCompiler$JavaTool0.compile(JavaCompiler.scala:84)
    at sbt
.compiler.JavaCompiler$class.compileWithReporter(JavaCompiler.scala:40)
    at sbt
.compiler.JavaCompiler$JavaTool0.compileWithReporter(JavaCompiler.scala:84)
    at sbt
.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$1.apply$mcV$sp(AggressiveCompile.scala:121)
    at sbt
.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$1.apply(AggressiveCompile.scala:121)
    at sbt
.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$1.apply(AggressiveCompile.scala:121)
    at sbt
.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:168)
    at sbt
.compiler.AggressiveCompile$$anonfun$3.compileJava$1(AggressiveCompile.scala:120)
    at sbt
.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:142)
    at sbt
.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:84)
    at sbt
.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:66)
    at sbt
.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:64)
    at sbt
.inc.IncrementalCommon.cycle(IncrementalCommon.scala:31)
    at sbt
.inc.Incremental$$anonfun$1.apply(Incremental.scala:62)
    at sbt
.inc.Incremental$$anonfun$1.apply(Incremental.scala:61)
    at sbt
.inc.Incremental$.manageClassfiles(Incremental.scala:89)
    at sbt
.inc.Incremental$.compile(Incremental.scala:61)
    at sbt
.inc.IncrementalCompile$.apply(Compile.scala:54)
    at sbt
.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:159)
    at sbt
.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:68)
    at com
.typesafe.zinc.Compiler.compile(Compiler.scala:201)
    at com
.typesafe.zinc.Compiler.compile(Compiler.scala:183)
    at com
.typesafe.zinc.Compiler.compile(Compiler.scala:174)
    at com
.typesafe.zinc.Compiler.compile(Compiler.scala:165)
    at io
.gatling.compiler.ZincCompiler$$anonfun$7.apply(ZincCompiler.scala:154)
    at io
.gatling.compiler.ZincCompiler$$anonfun$7.apply(ZincCompiler.scala:154)
    at scala
.util.Try$.apply(Try.scala:161)
    at io
.gatling.compiler.ZincCompiler$delayedInit$body.apply(ZincCompiler.scala:154)
    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)
Message has been deleted

Barry Perez

unread,
Feb 14, 2017, 4:53:01 AM2/14/17
to Gatling User Group
OK, this next error suggests that your paths aren't setup properly - your java compiler can't be found. Sort that out and hopefully your simulation will run successfully.
Reply all
Reply to author
Forward
0 new messages