在加特林,我收到了“线程“主”中的异常java.lang.ExceptionInInitializerError”的错误

时间:2019-11-26 13:04:44

标签: gatling

当我在scala目录下运行Engine.scala时,出现错误:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="imageContent">
  <img src='assets/images/progress.svg' id="srcImage" />
</div>

<div class="row">
  <div class="col-lg-3" id="image1">
    Step 1
  </div>
  <div class="col-lg-3" id="image2">
    Step 2
  </div>
  <div class="col-lg-3" id="image3">
    Step 3
  </div>
  <div class="col-lg-3" id="image4">
    Step 4
  </div>
</div>
</div>

而BaiduHomePageSimulation.scala是:

 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

我不知道该如何解决?有没有人遇到过类似的问题?

1 个答案:

答案 0 :(得分:0)

我遇到此错误,并能够通过将scala目录标记为Test Sources Root来解决该错误

右键单击scala文件夹>将目录标记为> Test Sources Root