mrniko / netty-socketio

Socket.IO server implemented on Java. Realtime java framework
Apache License 2.0
6.82k stars 1.65k forks source link

NoSuchMethodError: io.netty.util.internal.PlatformDependent.newAtomicIntegerFieldUpdater(Ljava/lang/Class;Ljava/lang/String;)Ljava/util/concurrent/atomic/AtomicIntegerFieldUpdater; #496

Open ghost opened 6 years ago

ghost commented 6 years ago

env

I ran ChatLauncher in mrniko/netty-socketio-dem with netty-socketio:1.7.13 , while it failed to start server.

error log

[main] INFO com.corundumstudio.socketio.SocketIOServer - Session store / pubsub factory used: MemoryStoreFactory (local session store only)
Exception in thread "main" io.netty.channel.ChannelException: Unable to create Channel from class class io.netty.channel.socket.nio.NioServerSocketChannel
    at io.netty.channel.ReflectiveChannelFactory.newChannel(ReflectiveChannelFactory.java:40)
    at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:319)
    at io.netty.bootstrap.AbstractBootstrap.doBind(AbstractBootstrap.java:281)
    at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:277)
    at com.corundumstudio.socketio.SocketIOServer.startAsync(SocketIOServer.java:151)
    at com.corundumstudio.socketio.SocketIOServer.start(SocketIOServer.java:123)
    at com.corundumstudio.socketio.demo.ChatLauncher.main(ChatLauncher.java:38)
Caused by: java.lang.NoSuchMethodError: io.netty.util.internal.PlatformDependent.newAtomicIntegerFieldUpdater(Ljava/lang/Class;Ljava/lang/String;)Ljava/util/concurrent/atomic/AtomicIntegerFieldUpdater;
    at io.netty.channel.ChannelOutboundBuffer.<clinit>(ChannelOutboundBuffer.java:92)
    at io.netty.channel.AbstractChannel$AbstractUnsafe.<init>(AbstractChannel.java:421)
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.<init>(AbstractNioChannel.java:218)
    at io.netty.channel.nio.AbstractNioMessageChannel$NioMessageUnsafe.<init>(AbstractNioMessageChannel.java:58)
    at io.netty.channel.nio.AbstractNioMessageChannel$NioMessageUnsafe.<init>(AbstractNioMessageChannel.java:58)
    at io.netty.channel.nio.AbstractNioMessageChannel.newUnsafe(AbstractNioMessageChannel.java:47)
    at io.netty.channel.nio.AbstractNioMessageChannel.newUnsafe(AbstractNioMessageChannel.java:35)
    at io.netty.channel.AbstractChannel.<init>(AbstractChannel.java:80)
    at io.netty.channel.nio.AbstractNioChannel.<init>(AbstractNioChannel.java:84)
    at io.netty.channel.nio.AbstractNioMessageChannel.<init>(AbstractNioMessageChannel.java:42)
    at io.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:85)
    at io.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:71)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at java.lang.Class.newInstance(Class.java:442)
    at io.netty.channel.ReflectiveChannelFactory.newChannel(ReflectiveChannelFactory.java:38)
    ... 6 more
jotgugu commented 6 years ago

me too...

lvjinchengcq commented 6 years ago

me too the dependency version do not have the function any more dependency groupId io.netty artifactId netty-transport version 4.1.5.Final dependency

jinny76 commented 6 years ago

Same issue when upgrading from 1.7.12 to 1.7.13

lilaizhencn commented 6 years ago

package eroor @jinny76

nickevin commented 6 years ago

Try this way, @jinny76 :

<dependency>
    <groupId>com.corundumstudio.socketio</groupId>
    <artifactId>netty-socketio</artifactId>
    <version>1.7.13</version>
</dependency>
<dependency>
    <groupId>io.netty</groupId>
    <artifactId>netty-transport</artifactId>
    <version>4.1.15.Final</version>
</dependency>
oryjk commented 6 years ago

I add

<dependency>
    <groupId>io.netty</groupId>
    <artifactId>netty-transport</artifactId>
    <version>4.1.15.Final</version>
</dependency>

it is work! but a warning occur:

Found Netty's native epoll transport in the classpath, but epoll is not available. Using NIO instead.

that means netty need linux native driver(I run on linux), but can not found

then I add

<dependency>
    <groupId>io.netty</groupId>
    <artifactId>netty-transport-native-epoll</artifactId>
    <version>4.1.15.Final</version>
    <classifier>linux-x86_64</classifier>
</dependency>

that work ok

jellythefish commented 3 years ago

Seems like this error is connected with invalid async-http-client version. In my case this answer helped: https://github.com/kamon-io/kamon-influxdb/issues/11#issuecomment-326270128 Try to fix it with:

<dependency>
    <groupId>org.asynchttpclient</groupId>
    <artifactId>async-http-client</artifactId>
    <version>2.0.35</version>
</dependency>