Reputation: 11
When I run Engine.scala under the scala directory,it gives an error:
Exception in thread "main" java.lang.ExceptionInInitializerError
at Engine$.delayedEndpoint$Engine$1(Engine.scala:7)
at Engine$delayedInit$body.apply(Engine.scala:4)
at scala.Function0.apply$mcV$sp(Function0.scala:34)
at scala.Function0.apply$mcV$sp$(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App.$anonfun$main$1$adapted(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:389)
at scala.App.main(App.scala:76)
at scala.App.main$(App.scala:74)
at Engine$.main(Engine.scala:4)
at Engine.main(Engine.scala)
Caused by: java.lang.NullPointerException
at io.gatling.commons.util.PathHelper$.url2path(PathHelper.scala:34)
at IDEPathHelper$.<init>(IDEPathHelper.scala:7)
at IDEPathHelper$.<clinit>(IDEPathHelper.scala)
... 11 more
And BaiduHomePageSimulation.scala is:
package test.scala
import io.gatling.core.Predef._
import io.gatling.http.Predef._
class BaiduSimulation extends Simulation {
// Set the root path of the request
val httpConf = http.baseUrl("https://www.baidu.com")
/*
run 10 seconds, during:the default unit is seconds, if you want to use microseconds eg. during(100 millisecond)
*/
val scn = scenario("BaiduSimulation").during(10){
exec(http("baidu_home").get("/"))
}
// set the thread count
setUp(scn.inject(atOnceUsers(10)).protocols(httpConf))
}
I don't konw how to fix it? Has anyone encountered a similar issue?
Upvotes: 1
Views: 1442
Reputation: 61
I was getting this error and was able to resolve it by marking the scala directory as Test Sources Root
Right click scala folder > Mark directory as > Test Sources Root
Upvotes: 3