gpt4 book ai didi

scala - 运行测试时未捕获的异常 : java. lang.NoClassDefFoundError: scala/collection/mutable/ArrayOps$ofRef

转载 作者:行者123 更新时间:2023-12-05 02:59:39 24 4
gpt4 key购买 nike

我有一个使用 Intellij Idea scala sbt 的项目设置。

sbtVersion = 1.2.8, scalaVersion = 2.13.0

我正在尝试设置 gatling,但在运行命令后出现以下错误:

gatling: test

[error] Uncaught exception when running tests: java.lang.NoClassDefFoundError: scala/collection/mutable/ArrayOps$ofRef [error] sbt.ForkMain$ForkError: java.lang.NoClassDefFoundError: scala/collection/mutable/ArrayOps$ofRef [error] at io.gatling.sbt.GatlingRunner.tasks(GatlingRunner.scala:31) [error] at sbt.ForkMain$Run.runTests(ForkMain.java:258) [error] at sbt.ForkMain$Run.run(ForkMain.java:144) [error] at sbt.ForkMain$Run.access$100(ForkMain.java:140) [error] at sbt.ForkMain.main(ForkMain.java:126) [error] Caused by: sbt.ForkMain$ForkError: java.lang.ClassNotFoundException: scala.collection.mutable.ArrayOps$ofRef [error] at java.net.URLClassLoader.findClass(URLClassLoader.java:381) [error] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) [error] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) [error] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) [error] at io.gatling.sbt.GatlingRunner.tasks(GatlingRunner.scala:31) [error] at sbt.ForkMain$Run.runTests(ForkMain.java:258) [error] at sbt.ForkMain$Run.run(ForkMain.java:144) [error] at sbt.ForkMain$Run.access$100(ForkMain.java:140) [error] at sbt.ForkMain.main(ForkMain.java:126) [info] Simulation(s) execution ended. [error] Error during tests: [error] Forked test harness failed: java.io.EOFException [error] at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2958) [error] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1538) [error] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431) [error] at sbt.React.react(ForkTests.scala:177) [error] at sbt.ForkTests$Acceptor$2$.run(ForkTests.scala:108) [error] at java.lang.Thread.run(Thread.java:748) [error] (Gatling / test) sbt.TestsFailedException: Tests unsuccessful [error] Total time: 6 s, completed 29-Aug-2019 09:53:58

build.sbt

enablePlugins(GatlingPlugin)

name := "performance-test"

version := "0.1"

scalaVersion := "2.13.0"

scalacOptions := Seq(
"-encoding", "UTF-8", "-target:jvm-1.8", "-deprecation",
"-feature", "-unchecked", "-language:implicitConversions", "-language:postfixOps")

libraryDependencies += "io.gatling.highcharts" % "gatling-charts-highcharts" % "3.2.1" % "test,it"
libraryDependencies += "io.gatling" % "gatling-test-framework" % "3.2.1" % "test,it"

plugins.sbt

addSbtPlugin("io.gatling" % "gatling-sbt" % "3.0.0")

BasicSimulation.scala

package idcheck

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._

class BasicSimulation extends Simulation {

val httpProtocol = http
.baseUrl("https://google.com")

val base = scenario("Test")
.exec(http("base endpoint")
.get("/"))

setUp(base.inject(atOnceUsers(1)).protocols(httpProtocol))

}

最佳答案

是的,这个错误来自 scala 2.13.x,降级到 2.12.11 :(

关于scala - 运行测试时未捕获的异常 : java. lang.NoClassDefFoundError: scala/collection/mutable/ArrayOps$ofRef,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57706600/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com