I am trying to use "software.amazon.awssdk" % "dynamodb" % "2.10.33"
with my project on Play framework (Java).
Following is a brief of the project configuration
scalaVersion := "2.11.8"
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.14")
sbt.version=0.13.8
Tried excluding netty dependency from the new package
("software.amazon.awssdk" % "dynamodb" % "2.10.33").excludeAll(ExclusionRule(organization = "io.netty"))
The project worked fine with
"com.amazonaws" % "aws-java-sdk-core" % "1.10.52",
"com.amazonaws" % "aws-java-sdk-s3" % "1.10.52",
"com.amazonaws" % "aws-java-sdk-dynamodb" % "1.10.52"
Upgrading to the new AWS library seems to break the project. sbt compile
returns success
However, sbt run
results in the aforementioned error.
java.lang.NoSuchMethodError:
> io.netty.channel.DefaultChannelId.newInstance()Lio/netty/channel/DefaultChannelId;
[info] Running the application with Aspectj Weaver
--- (Running the application, auto-reloading is enabled) ---
java.lang.NoSuchMethodError: io.netty.channel.DefaultChannelId.newInstance()Lio/netty/channel/DefaultChannelId;
at io.netty.channel.AbstractChannel.newId(AbstractChannel.java:100)
at io.netty.channel.AbstractChannel.<init>(AbstractChannel.java:72)
at io.netty.bootstrap.FailedChannel.<init>(FailedChannel.java:33)
at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:308)
at io.netty.bootstrap.AbstractBootstrap.doBind(AbstractBootstrap.java:260)
at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:227)
at play.core.server.NettyServer.bind(NettyServer.scala:139)
at play.core.server.NettyServer.play$core$server$NettyServer$$bindChannel(NettyServer.scala:224)
at play.core.server.NettyServer$$anonfun$1.apply(NettyServer.scala:216)
at play.core.server.NettyServer$$anonfun$1.apply(NettyServer.scala:216)
at scala.Option.map(Option.scala:146)
at play.core.server.NettyServer.<init>(NettyServer.scala:216)
at play.core.server.NettyServerProvider.createServer(NettyServer.scala:279)
at play.core.server.NettyServerProvider.createServer(NettyServer.scala:278)
at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerStart.scala:235)
at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerStart.scala:65)
at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
at play.core.server.DevServerStart$.mainDev(DevServerStart.scala:64)
at play.core.server.DevServerStart$.mainDevHttpMode(DevServerStart.scala:54)
at play.core.server.DevServerStart.mainDevHttpMode(DevServerStart.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at play.runsupport.Reloader$.startDevMode(Reloader.scala:234)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.devModeServer$lzycompute$1(PlayRun.scala:74)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.play$sbt$run$PlayRun$$anonfun$$anonfun$$anonfun$$devModeServer$1(PlayRun.scala:74)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.apply(PlayRun.scala:100)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.apply(PlayRun.scala:53)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
Attached dependency tree: https://drive.google.com/file/d/1dVf8aJiv2i0Tscn2XEhETQ-ae3dgqfHk/view?usp=sharing
You are trying to use two incompatible versions of Netty. That is impossible.
Upgrading to Play 2.6 or later would solve this for two reasons:
edit: the AWS SDK uses Netty only as its default http client, which can be replaced.
libraryDependencies ++= Seq(
"software.amazon.awssdk" % "dynamodb" % "2.10.33" exclude("software.amazon.awssdk", "netty-nio-client")
)