为什么Akka-Http仍然使用较旧的Akka-Actor? [英] Why Akka-Http still uses older Akka-Actor?

查看:187
本文介绍了为什么Akka-Http仍然使用较旧的Akka-Actor?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have added the latest akka-http to my project but that includes the very old 2.4.19 version on akka-actor. Hence I also added akka-actor version 2.5.4 to the dependency. However, that results into following error:-

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

我的Maven配置如下:-

My maven config is like below:-

<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版本?

What am I missing? Is there any version of akka-http which uses the latest akka-actor?

更新:添加了依赖关系图

推荐答案

来自

Akka HTTP 10.0.x与两者 Akka 2.4.x和Akka 2.5.x都(二进制)兼容,但是为了简化此过程,构建(以及由此发布的工件)取决于2.4系列.根据依赖项的结构方式,您可能会遇到以下情况:您依赖于2.5系列中的akka-actor,而您依赖于10.0系列中的akka-http,这反过来又会短暂地引入<版本2.4中的c7>依赖关系打破了二进制兼容性要求,即所有Akka模块必须具有相同版本,因此akka-streams依赖关系必须与akka-actor是相同版本(因此2.5中的确切版本系列).

Akka HTTP 10.0.x is (binary) compatible with both Akka 2.4.x as well as Akka 2.5.x, however in order to facilitate this the build (and thus released artifacts) depend on the 2.4 series. Depending on how you structure your dependencies, you may encounter a situation where you depended on akka-actor of the 2.5 series, and you depend on akka-http from the 10.0 series, which in turn would transitively pull in the akka-streams dependency in version 2.4 which breaks the binary compatibility requirement that all Akka modules must be of the same version, so the akka-streams dependency MUST be the same version as akka-actor (so the exact version from the 2.5 series).

为了解决此依赖性问题,您必须显式依赖akka流,并使其与其余Akka环境相同的版本....

In order to resolve this dependency issue, you must depend on akka-streams explicitly, and make it the same version as the rest of your Akka environment....

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

Change your Maven dependencies to the following:

<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>

这篇关于为什么Akka-Http仍然使用较旧的Akka-Actor?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆