解決netty-socketio依賴問題

在一個項目中用到netty-socketio碰到一個問題,有新手碰到這個問題可能會糾結(jié)不少時間,寫出來以供參考,有碰到類似問題的也可以節(jié)省點兒時間。。

在項目源碼編譯時報錯,錯誤截圖如下

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的包,同樣反編譯查看源碼,并沒有發(fā)現(xiàn)newAtomicLongFieldUpdater 這樣一個方法。

同樣4.1.5.final 的包竟然出現(xiàn)方法找不到的問題,這個不會是坑爹專用版吧???

找到netty-all-4.1.5.Final 看了下源碼 發(fā)現(xiàn) ChannelOutboundBuffer的實現(xiàn)已經(jīng)完全不一樣了。

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

 <dependency>
      <groupId>com.corundumstudio.socketio</groupId>
      <artifactId>netty-socketio</artifactId>
      <version>1.7.13</version>
      <exclusions>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty-common</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty-transpor</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty-buffer</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty-handler</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty-codec-http</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty-codec</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty-resolver</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty-transport</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty-transport-native-epoll</artifactId>
        </exclusion>
      </exclusions>
</dependency>

自己引入netty-all的依賴


<dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-all</artifactId>
      <version>4.1.16.Final</version>
 </dependency>

好了, 這樣就不會有問題了

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Android 自定義View的各種姿勢1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 179,178評論 25 708
  • Spring Boot 參考指南 介紹 轉(zhuǎn)載自:https://www.gitbook.com/book/qbgb...
    毛宇鵬閱讀 47,281評論 6 342
  • 當(dāng)聽到電話那頭你哭鼻子,還能哭得那么兇的時候,我就笑了,難道你就真的長不大? 然后腦子了響起齊一在《致自己》中唱到...
    螢火蟲de夢閱讀 138評論 0 0
  • 老字號的港式餐廳,由于某種原因我對它格外鐘愛。餐廳環(huán)境干凈利落,沿襲了港式茶餐廳的一貫傳統(tǒng)。菜品推薦:冰火菠蘿油、...
    鹿肉串燒閱讀 327評論 0 0
  • 不知道天使會不會特別眷顧哭泣的女孩,讓她的淚滴也能開花結(jié)果,絢麗綻放。 還記得那年,我也曾隨手在課本上寫...
    一切都好lmy閱讀 295評論 0 1

友情鏈接更多精彩內(nèi)容