Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc: java.lang.NoSuchMethodError in NettyResponseHandler (Scala 3) #3104

Open
xerial opened this issue Aug 4, 2023 · 0 comments
Open

rpc: java.lang.NoSuchMethodError in NettyResponseHandler (Scala 3) #3104

xerial opened this issue Aug 4, 2023 · 0 comments
Milestone

Comments

@xerial
Copy link
Member

xerial commented Aug 4, 2023

When updating RPC method parameters, recompilation of classes defining RxRouter.add[...Impl] is always required (e.g., via clean; compile). Otherwize, NoSuchMethodError can be thrown like this:

server[ERROR] java.lang.NoSuchMethodError: (RPC response type) (RPC Method name)
server[ERROR] 	at ----
server[ERROR] 	at wvlet.airframe.surface.StaticMethodParameter.get$$anonfun$1(Surfaces.scala:109)
server[ERROR] 	at scala.Option.map(Option.scala:242)
server[ERROR] 	at wvlet.airframe.surface.StaticMethodParameter.get(Surfaces.scala:109)
server[ERROR] 	at wvlet.airframe.codec.ParamListCodec.packAsMap$$anonfun$2(ObjectCodec.scala:85)
server[ERROR] 	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
server[ERROR] 	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
server[ERROR] 	at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:575)
server[ERROR] 	at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:573)
server[ERROR] 	at scala.collection.AbstractIterable.foreach(Iterable.scala:933)
server[ERROR] 	at scala.collection.IterableOps$WithFilter.foreach(Iterable.scala:903)
server[ERROR] 	at wvlet.airframe.codec.ParamListCodec.packAsMap(ObjectCodec.scala:89)
server[ERROR] 	at wvlet.airframe.codec.ObjectMapCodec.pack(ObjectCodec.scala:259)
server[ERROR] 	at wvlet.airframe.codec.ObjectMapCodec.packAsMap(ObjectCodec.scala:261)
server[ERROR] 	at wvlet.airframe.codec.MessageCodec.toMsgPack(MessageCodec.scala:67)
server[ERROR] 	at wvlet.airframe.codec.MessageCodec.toMsgPack$(MessageCodec.scala:26)
server[ERROR] 	at wvlet.airframe.codec.ObjectMapCodec.toMsgPack(ObjectCodec.scala:251)
server[ERROR] 	at wvlet.airframe.http.netty.NettyResponseHandler.toHttpResponse(NettyResponseHandler.scala:43)
server[ERROR] 	at wvlet.airframe.http.netty.NettyResponseHandler.toHttpResponse(NettyResponseHandler.scala:27)

I guess this RxRouter code is always recompiled when Api changes:

object MyApi extends RxRouterProvider {
  override def router = RxRouter.of[MyApi]
}

But when binding the concrete implementation like this, recompilation will not be triggered:

RxRouter.of[MyApiImpl]

Probably instead of binding concrete API implementation in the router, it should have another way to provide the implementation.

@xerial xerial added this to the Airframe 24 milestone Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant