Gatling Maven throws exception if given -Dgatling.simulation

726 views
Skip to first unread message

Alvin Lin

unread,
Mar 23, 2013, 7:47:38 AM3/23/13
to gat...@googlegroups.com
I checked out the gatling maven demo project and run the gatling:execute goal with gatling.simulation argument, but get the following exception. Did I do anything wrong?


mvn gatling:execute -Dgatling.simulation=basic.BasicExampleSimulation
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building gatling-maven-plugin-demo 1.4.5
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- gatling-maven-plugin:1.4.5:execute (default-cli) @ gatling-maven-plug
in-demo ---
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at scala_maven_executions.MainHelper.runMain(MainHelper.java:164)
        at scala_maven_executions.MainWithArgsInFile.main(MainWithArgsInFile.jav
a:26)
Caused by: com.typesafe.config.ConfigException$WrongType: system properties: gat
ling.simulation has type STRING rather than OBJECT
        at com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:124)
        at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:138)
        at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:142)
        at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:150)
        at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:155)
        at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:197
)
        at com.excilys.ebi.gatling.core.config.GatlingConfiguration$.setUp(Gatli
ngConfiguration.scala:46)
        at com.excilys.ebi.gatling.app.Gatling$.fromMap(Gatling.scala:53)
        at com.excilys.ebi.gatling.app.Gatling$.runGatling(Gatling.scala:73)
        at com.excilys.ebi.gatling.app.Gatling$.main(Gatling.scala:49)
        at com.excilys.ebi.gatling.app.Gatling.main(Gatling.scala)
        ... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.856s
[INFO] Finished at: Sat Mar 23 04:42:16 PDT 2013
[INFO] Final Memory: 6M/184M
[INFO] ------------------------------------------------------------------------

 

Stéphane Landelle

unread,
Mar 23, 2013, 8:31:39 AM3/23/13
to gat...@googlegroups.com
Funny one.
That's a naming conflict.

Here's what happens:
  • you're passing -Dgatling.simulation in order to configure the target simulation from the command line instead of setting up statically in the pom.xml (perfect use case)
  • the gatling maven plugin default behavior is fork + propagateSystemProperties, so the system property gatling.simulation is propagated to the forked JVM that will run Gatling
  • the configuration framework let one override the configuration file with System properties, the problem is that it expects gatling.simulation to be an Object (see gatling.conf file) and not a String
I guess the only proper solution is to change/translate the gatling-maven-plugin properties so that they can never conflict with the main engine ones.

As a workaround, you can:
  • disable propagateSystemProperties, see https://github.com/excilys/gatling/wiki/Maven-plugin#wiki-advanced. However, depending on your use case, you might need to propagate them.
  • don't set up directly maven plugin gatling.simulation property, but its value. I think something like this might work (haven't tested, please let me know:
mvn gatling:execute -Dfoo=basic.BasicExampleSimulation

<configuration>
  <simulation>${foo}</simulation>
</configuration>

Cheers,

Stéphane


2013/3/23 Alvin Lin <alvin...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Alvin Lin

unread,
Mar 23, 2013, 8:36:37 AM3/23/13
to gat...@googlegroups.com
Thanks for prompt reply. I will definitely give it a try and let you
know :). It's 5 AM here now, so I will defer the task until later.

Cheers,
Alvin
> You received this message because you are subscribed to a topic in the
> Google Groups "Gatling User Group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/gatling/l7R9QVmnCs4/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to

Stéphane Landelle

unread,
Mar 23, 2013, 8:38:38 AM3/23/13
to gat...@googlegroups.com
Good night, then! :)


2013/3/23 Alvin Lin <alvin...@gmail.com>

Alvin Lin

unread,
Mar 26, 2013, 2:14:43 AM3/26/13
to gat...@googlegroups.com
<configuration>
  <simulation>${foo}</simulation>
</configuration> 

actually works :)

Stéphane Landelle

unread,
Mar 26, 2013, 3:16:25 AM3/26/13
to gat...@googlegroups.com
Glad to hear, thanks for your feedback.

We've had to rename the property from "simulation" to "simulationClass" in 1.4.6 in order to avoid the clash.
Be aware of this when upgrading.

Cheers,

Stéphane


2013/3/26 Alvin Lin <alvin...@gmail.com>
Reply all
Reply to author
Forward
0 new messages