vendredi 30 août 2019

How to fix: java.lang.ClassNotFoundException: BasicSimulation for gradle gatlingRun task?

I'm trying to run a gatling task via gradle. I specifically set my scala sourceCode set, run compileScala befor running gatlingRun, but I keep on getting an error: java.lang.ClassNotFoundException: BasicSimulation

How do I set up te task properly? The build.gradle:

plugins {
    id "com.github.lkishalmi.gatling" version "3.0.2"
}
repositories {
    mavenCentral()
}
apply plugin: 'java'
apply plugin: 'scala'

sourceSets {
    main {
        scala {
            srcDirs = ['src/gatling/simulations/']
        }
    }
}



dependencies {
    compile "io.gatling:gatling-core:3.0.2"
    compile "io.gatling:gatling-http:3.0.2"
    compile 'io.gatling.highcharts:gatling-charts-highcharts:3.0.2'
    compile 'org.scala-lang:scala-library:2.11.8'
    testCompile "io.gatling:gatling-core:3.0.2"
    testCompile "io.gatling:gatling-http:3.0.2"
    testCompile 'io.gatling.highcharts:gatling-charts-highcharts:3.0.2'

}

gatling {
    simulations = {
        include "*.scala"
    }
}



Gradle syntax: gradlew compileScala gatlingRun -Dorg.gradle.java.home=C:\Users\saber.alex\Documents\jre1.8.0_91

Error:


> Task :gatlingRun
16:22:52.131 [main] INFO io.gatling.core.config.GatlingConfiguration$ - Gatling will try to use 'gatling.conf' as custom config file.
16:22:52.910 [GatlingSystem-akka.actor.default-dispatcher-2] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
16:22:54.045 [main] ERROR io.gatling.app.Gatling$ - Run crashed
java.lang.IllegalArgumentException: User defined Simulation class BasicSimulation could not be loaded
    at io.gatling.app.Selection$Selector.findUserDefinedSimulationInClassloader$1(Selection.scala:79)
    at io.gatling.app.Selection$Selector.$anonfun$singleSimulationFromConfig$4(Selection.scala:84)
    at scala.Option.orElse(Option.scala:289)
    at io.gatling.app.Selection$Selector.$anonfun$singleSimulationFromConfig$3(Selection.scala:84)
    at scala.Option.flatMap(Option.scala:171)
    at io.gatling.app.Selection$Selector.singleSimulationFromConfig(Selection.scala:82)
    at io.gatling.app.Selection$Selector.$anonfun$selection$1(Selection.scala:52)
    at scala.Option.getOrElse(Option.scala:121)
    at io.gatling.app.Selection$Selector.selection(Selection.scala:44)
    at io.gatling.app.Selection$.apply(Selection.scala:36)
    at io.gatling.app.Runner.run0(Runner.scala:74)
    at io.gatling.app.Runner.run(Runner.scala:61)
    at io.gatling.app.Gatling$.start(Gatling.scala:74)
    at io.gatling.app.Gatling$.fromArgs(Gatling.scala:47)
    at io.gatling.app.Gatling$.main(Gatling.scala:39)
    at io.gatling.app.Gatling.main(Gatling.scala)
Caused by: java.lang.ClassNotFoundException: BasicSimulation
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at io.gatling.app.Selection$Selector.$anonfun$singleSimulationFromConfig$2(Selection.scala:70)
    at scala.util.Try$.apply(Try.scala:209)
    at io.gatling.app.Selection$Selector.findUserDefinedSimulationInClassloader$1(Selection.scala:70)
    ... 15 common frames omitted

> Task :gatlingRun FAILED
3 actionable tasks: 3 executed

Thanks before.

Aucun commentaire:

Enregistrer un commentaire