为什么 Akka-Http 仍然使用旧的 Akka-Actor?

2024-01-02

我已将最新的 akka-http 添加到我的项目中,但其中包括 akka-actor 上非常旧的 2.4.19 版本。因此我还将 akka-actor 版本 2.5.4 添加到依赖项中。但是,这会导致以下错误:-

Detected java.lang.NoSuchMethodError error, which MAY be caused by incompatible Akka versions on the classpath.

我的 Maven 配置如下:-

<dependencies>
    <dependency>
        <groupId>com.typesafe.akka</groupId>
        <artifactId>akka-http_2.11</artifactId>
        <version>10.0.9</version>
    </dependency>
    <dependency>
        <groupId>com.typesafe.akka</groupId>
        <artifactId>akka-actor_2.11</artifactId>
        <version>2.5.4</version>
    </dependency>
</dependencies>

我缺少什么?有没有使用最新 akka-actor 的 akka-http 版本?

更新:添加了依赖关系图


来自兼容性指南 http://doc.akka.io/docs/akka-http/current/scala/http/compatibility-guidelines.html文档中的页面:

Akka HTTP 10.0.x(二进制)兼容both Akka 2.4.x还有阿卡2.5.x,但是为了促进这一点,构建(以及因此发布的工件)取决于2.4系列。根据您构建依赖关系的方式,您可能会遇到依赖项的情况akka-actor of the 2.5系列,你依赖akka-http来自10.0系列,这反过来又会间接地拉动akka-streams版本依赖2.4这打破了所有 Akka 模块必须具有相同版本的二进制兼容性要求,因此akka-streams依赖项必须与以下版本相同akka-actor(所以确切的版本来自2.5系列)。

为了解决这个依赖问题,你必须明确依赖 akka-streams,并使其与你的 Akka 环境的其余部分版本相同......

将 Maven 依赖项更改为以下内容:

<dependencies>
    <dependency>
        <groupId>com.typesafe.akka</groupId>
        <artifactId>akka-actor_2.11</artifactId>
        <version>2.5.4</version>
    </dependency>
    <!-- Explicitly depend on akka-streams in same version as akka-actor -->
    <dependency>
        <groupId>com.typesafe.akka</groupId>
        <artifactId>akka-stream_2.11</artifactId>
        <version>2.5.4</version>
    </dependency>
    <dependency>
        <groupId>com.typesafe.akka</groupId>
        <artifactId>akka-http_2.11</artifactId>
        <version>10.0.9</version>
    </dependency>
</dependencies>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

为什么 Akka-Http 仍然使用旧的 Akka-Actor? 的相关文章

随机推荐