-
Notifications
You must be signed in to change notification settings - Fork 15
Known issues
It is currently impossible to compile your DSE simulations with the Gatling Zinc compiler. You need to use the official Scala compiler to solve this problem.
If you see this error in your console output, it is because you are using the Zinc compiler.
Error:(22, 33) illegal cyclic reference involving class Cluster
val cbuilder = new DseCluster.Builder()
The cause of this error is not clearly identified at this time.
It seems that the Scala compiler cannot handle a certain class hierarchy.
Even if that hierarchy is written in Java and already compiled to bytecode.
This certain class hierarchy happens to exist in the DSE java-driver codebase.
Therefore, connecting to a DSE cluster triggers this scalac
issue.
A JIRA ticket has been opened for the Scala compiler. But it is still unresolved, as of 2018-07-01. A JIRA ticket has also been opened for the DSE java-driver. But it would require a major refactoring on the public API, as it impacts the public class hierarchy. So it will not be fixed before the future major version of the driver (currently not scheduled).
Whenever you use the Gatling DSE plugin, make sure to use the official Scala compiler.
Pass it the following arguments to solve the issue: -unchecked -feature -Ybreak-cycles
.
This changes the class hierarchy resolution mechanism in the Scala compiler and solves the compilation error.
The following sections describe two ways of achieving this.
The easiest work-around consists in using the official Gatling Maven plugin.
Once your simulations are in a Maven project, include the scala compiler plugin in your build
section.
<project>
...
<build>
...
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin.version}</version>
<configuration>
<args>
<arg>-unchecked</arg>
<arg>-feature</arg>
<arg>-Ybreak-cycles</arg>
</args>
<scalaVersion>${scala.version}</scalaVersion>
</configuration>
</plugin>
....
</plugins>
</build>
....
</project>
As stated in the official documentation, you are now compiling your classes separately from Gatling. You can now disable the Gatling compiler to avoid building the simulations twice.
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling-maven-plugin.version}</version>
...
<configuration>
<disableCompiler>true</disableCompiler>
</configuration>
</plugin>
...
</plugins>
....
</build>
....
</project>
Then, whenever you start Gatling, use the following command:
mvn scala:testCompile gatling:execute ...
Another solution requires to manually compile your simulations. The advantage here is that you do not need Maven. You directly use the tools available in the Gatling bundle.
First, download and extract a gatling bundle, cd
in that directory.
Add the Gatling DSE plugin in the lib/
folder.
Add your simulation in the user-files/simulations/
directory.
Now, prevent Gatling from trying to compile simulations.
To do so, edit gatling.sh
and remove this line (should be L51).
"$JAVA" $COMPILER_OPTS -cp "$COMPILER_CLASSPATH" io.gatling.compiler.ZincCompiler -ccp "$COMPILATION_CLASSPATH" "$@" 2> /dev/null
Then, manually compile your simulation with this command.
scalac \
-classpath `find ./lib -maxdepth 1 -name "*.jar" -type f -exec printf :{} ';'` \
-d target/test-classes/ \
-unchecked -feature -Ybreak-cycles \
user-files/simulations/MyDseSimulation.scala
Now you can run bin/gatling.sh
as usual, it should look like this:
$ bin/gatling.sh
GATLING_HOME is set to /tmp/gatling-charts-highcharts-bundle-2.3.1
MyDseSimulation is the only simulation, executing it.
Select simulation id (default is 'basicsimulation'). Accepted characters are a-z, A-Z, 0-9, - and _
Select run description (optional)
...