为什么 Akka-Http 仍然使用旧的 Akka-Actor?
Why Akka-Http still uses older Akka-Actor?
我已将最新的 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 版本?
更新:添加了依赖图
来自文档中的 Compatibility Guidelines 页面:
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).
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 依赖项更改为以下内容:
<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 上非常旧的 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 版本?
更新:添加了依赖图
来自文档中的 Compatibility Guidelines 页面:
Akka HTTP 10.0.x is (binary) compatible with both Akka
2.4.x
as well as Akka2.5.x
, however in order to facilitate this the build (and thus released artifacts) depend on the2.4
series. Depending on how you structure your dependencies, you may encounter a situation where you depended onakka-actor
of the2.5
series, and you depend onakka-http
from the10.0
series, which in turn would transitively pull in theakka-streams
dependency in version2.4
which breaks the binary compatibility requirement that all Akka modules must be of the same version, so theakka-streams
dependency MUST be the same version asakka-actor
(so the exact version from the2.5
series).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 依赖项更改为以下内容:
<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>