解决netty-socketio依赖问题

在一个项目中用到netty-socketio碰到一个问题,有新手碰到这个问题可能会纠结不少时间,写出来以供参考,有碰到类似问题的也可以节省点儿时间。。

在项目源码编译时报错,错误截图如下

解决netty-socketio依赖问题_第1张图片
Paste_Image.png

错误信息显示 io.netty.util.internal.PlatformDependent

反编译netty-transport-4.1.5.Final 的代码可以看到

ChannelOutboundBuffer 里有一行代码 如下

AtomicIntegerFieldUpdater unwritableUpdater = PlatformDependent.newAtomicIntegerFieldUpdater(ChannelOutboundBuffer.class, "unwritable");

PlatformDependent 是在netty-common-4.1.5.Final的包,同样反编译查看源码,并没有发现newAtomicLongFieldUpdater 这样一个方法。

同样4.1.5.final 的包竟然出现方法找不到的问题,这个不会是坑爹专用版吧???

找到netty-all-4.1.5.Final 看了下源码 发现 ChannelOutboundBuffer的实现已经完全不一样了。

索性把netty的分包的依赖全部替换掉, 修改maven的pom文件

 
      com.corundumstudio.socketio
      netty-socketio
      1.7.13
      
        
          io.netty
          netty-common
        
        
          io.netty
          netty-transpor
        
        
          io.netty
          netty-buffer
        
        
          io.netty
          netty-handler
        
        
          io.netty
          netty-codec-http
        
        
          io.netty
          netty-codec
        
        
          io.netty
          netty-resolver
        
        
          io.netty
          netty-transport
        
        
          io.netty
          netty-transport-native-epoll
        
      

自己引入netty-all的依赖



      io.netty
      netty-all
      4.1.16.Final
 

好了, 这样就不会有问题了

你可能感兴趣的:(解决netty-socketio依赖问题)