java.nio.channels.UnsupportedAddressTypeException

459 views Asked by At

I'm building a test gRPC server with Mill using ScalaPBModule. I can successfully build (with server.assembly) and start the server, but when it is hit with a request, the client throws this error:

Suppressed: java.nio.channels.UnsupportedAddressTypeException: null at java.base/sun.nio.ch.Net.checkAddress(Net.java:127) ... io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)

(I am sure there is no problem with the client.)

Here is my build config:

object server extends ScalaPBModule {
  def scalaVersion = "2.13.5"
  def scalaPBVersion = "0.11.12"
  override def scalaPBGrpc = true

  def ivyDeps = Agg(
    ivy"dev.zio::zio:2.0.5",
    // ivy"dev.zio::zio_3:2.0.5",
    // ivy"dev.zio::zio-direct:1.0.0-RC1",
    ivy"dev.zio::zio-direct:1.0.0-RC1+8-da53f9ae-SNAPSHOT",
    // ivy"dev.zio::zio-direct_3:1.0.0-RC1",
    ivy"org.mongodb.scala::mongo-scala-driver:4.8.0",
    ivy"io.grpc:grpc-netty:1.51.1", // ${scalapb.compiler.Version.grpcJavaVersion}",
    ivy"io.grpc:grpc-alts:1.51.1",
    ivy"io.grpc:grpc-protobuf:1.51.1",
    ivy"io.grpc:grpc-stub:1.51.1",
    ivy"io.grpc:grpc-testing:1.51.1",
    ivy"com.thesamet.scalapb::scalapb-runtime-grpc:0.11.12",
    ivy"com.thesamet.scalapb.zio-grpc::zio-grpc-core:0.0.0+1-02300782-SNAPSHOT"
  )
}

I see others reporting this problem with gradle and maven and solving it with shadowing, etc. - how can this be done with Mill? Appreciate any help!

EDIT: The problem is the client, not the server; here is my client code.

EDIT 2: The code is irrelevant; it's a packaging issue as I suggested initially.

object Main extends ZIOAppDefault {
  val app = for {
    args <- getArgs
    channel <- ZIO.attempt(ManagedChannelBuilder.forAddress(args(0), 50051).usePlaintext().build)
    stub <- ZIO.attempt(TestGrpc.stub(channel))
    _ <- ZIO.fromFuture(_ => createMessage(stub))
  } yield ()

Client deps are the same.

0

There are 0 answers