2017-08-27 46 views
2

我已將最新的akka​​-http添加到我的項目中,但其中包含非常老的2.4.19版本的akka​​-演員。因此我還將akka-actor版本2.5.4添加到依賴項。但是,導致到以下錯誤: -爲什麼Akka-Http仍然使用較老的Akka-Actor?

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​​演員的任何版本的akka​​-http?

更新:新增依賴圖

Dependecy graph. Note 10.0.9 includes actor 2.4.19 not the latest

回答

1

從文檔中的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> 
+0

謝謝。這正是我所期待的。我錯過了這一點。 – AppleGrew

相關問題