0

I am trying to use the Alpakka S3 connector

When I instantiate the S3Client I get the exception

Exception in thread "main" java.lang.NoSuchMethodError: akka.util.OptionVal$.contains$extension(Ljava/lang/Object;Ljava/lang/Object;)

It occurs at

  override def offsetOfModule(out: OutPort): Int = {
if (outPort.contains(out)) {
  pendingBuilder match {
    case OptionVal.Some(composite) ⇒ composite.offsetOfModule(out)
    case OptionVal.None            ⇒ 0 // Output belongs to the last module, which will be materialized *first*
  }
} else
  throw new IllegalArgumentException(s"Port $out cannot be accessed in this builder")

}

in akka-stream (2.11 vs 2.5.12). The variable outPort is of type OptionVal.

The method does indeed not exist in OptionVal of the util package in akka-actor_2.11:2.2.20. Same in the akka actor repository. But here it is documented as existing.

Why do these methods not exist? Do I miss a dependency? I used

<dependency>
    <groupId>com.lightbend.akka</groupId>
    <artifactId>akka-stream-alpakka-s3_2.11</artifactId>
    <version>0.19</version>
</dependency>
Daniel
  • 1,522
  • 1
  • 12
  • 25

1 Answers1

0

The problem here is that some dependency pulled in akka-actor_2.11 version 2.2.20 which is very old and does not have the method mentioned in the exception.

Take a look at the output of mvn dependency:analyze and mvn dependency:tree and see which dependency brings in outdated Akka. Then update that dependency or force the usage of the latest Akka in your project by adding

<dependencyManagement>
  <dependencies>
    <dependency>
        <groupId>com.typesafe.akka</groupId>
        <artifactId>akka-actor_2.11</artifactId>
        <version>2.5.13</version>
    </dependency>
  </dependencies>
</dependencyManagement>

to your POM.

dvim
  • 2,223
  • 1
  • 17
  • 17