新的TestKitJunitResource实例出现了NoClassDefFoundError异常:scala / collection / StringOps $

时间:2019-06-24 08:21:52

标签: akka akka-typed

我是Akka的新手。当我尝试在Maven Java项目中初始化akka.actor.testkit.typed.javadsl.TestKitJunitResource实例时,总是遇到NoClassDefFoundError: scala/collection/StringOps$.

的异常。

我遵循Akka输入在线文档的教程,并在pom.xml文件中添加了所有必需的依赖项,如下所示:

<dependency>
  <groupId>com.typesafe.akka</groupId>
  <artifactId>akka-actor-typed_2.12</artifactId>
  <version>2.5.23</version>
</dependency>
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.12</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>com.typesafe.akka</groupId>
  <artifactId>akka-actor-testkit-typed_2.13</artifactId>
  <version>2.5.23</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.scalatest</groupId>
  <artifactId>scalatest_2.12</artifactId>
  <version>3.0.8</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.scalatest</groupId>
  <artifactId>scalatest-maven-plugin</artifactId>
  <version>2.0.0</version>
</dependency>
<dependency>
    <groupId>org.scala-lang</groupId>
    <artifactId>scala-library</artifactId>
    <version>2.11.7</version>
</dependency>

当我为一个演员运行单元测试时,以下语句引发了异常:

@ClassRule public static final TestKitJunitResource testKit = new TestKitJunitResource();

故障跟踪如下:

java.lang.NoClassDefFoundError: scala/collection/StringOps$
at akka.actor.testkit.typed.internal.TestKitUtils$.<clinit>(TestKitUtils.scala:54)
at akka.actor.testkit.typed.javadsl.TestKitJunitResource.<init>(TestKitJunitResource.scala:40)

我想可能是由于某些依赖冲突或我错过了一些重要的图书馆。有人可以帮我一个线索吗?预先感谢!

0 个答案:

没有答案