本文介绍了为什么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流,并使其与其余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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 10:15