Facing NoSuchMethodError for io.netty.util.AttributeKey.valueOf() method with grpc and protobuf Hello world example

青春壹個敷衍的年華 提交于 2019-12-03 09:23:39

There could be multiple versions of netty jar in you class path during runtime. Use following command to check dependency tree.

mvn dependency:tree -Dverbose 

Or your container provides the netty jar might be clashing with the version of jar you packaging with your application.

Here is what worked for me. I needed to shade io.netty and com.google.

   <relocation>
      <pattern>io.netty</pattern>
      <shadedPattern>myshade.io.netty</shadedPattern>
    </relocation>
    <relocation>
       <pattern>com.google</pattern>
       <shadedPattern>myshade.com.google</shadedPattern>
   </relocation>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!