1

I am recently working with netty and send packets between NettyClient and a NettyServer. Unfortunately, I am receiving the following java.lang.AbstractMethodError:

java.lang.AbstractMethodError: io.netty.channel.SimpleChannelInboundHandler.channelRead0(Lio/netty/channel/ChannelHandlerContext;Ljava/lang/Object;)V
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:326)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:313)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:427)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:281)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1422)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:931)
    at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:792)
    at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:502)
    at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407)
    at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1050)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)

This error occurs when my client receives a packet from the server. The other way, everxthing works fine. I already checked the version of both programms, and they use the netty-all artifact on version 5.0.0.Alpha2.

The code of my SimpleChannelInboundHandler of my client looks like the following:

package de.jackboyplay.nettyclient.mechanics;

import de.jackboyplay.nettyclient.packets.Packet;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

public class NetworkHandler extends SimpleChannelInboundHandler<Packet>{


    @Override
    protected void messageReceived(ChannelHandlerContext chc, Packet packet) {
        packet.handle();
    }    

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {      
        cause.printStackTrace();
        ctx.close();
    }

}

~JackboyPlay

  • This error means that you are running your program with an incompatible set of libraries. One library A expects a certain method to exist in another library B, but it doesn't, because you are using the wrong version of library B. To really find out what the exact cause is, you'll have to dive into the details and analyze all the dependencies of your project. – Jesper Jun 16 '21 at 08:05
  • @Jesper is it somehow possible to identify the line or library which causes this? – JackboyPlay Jun 16 '21 at 11:19
  • I ckecked my libraries and none of them uses netty. The only one I am using is lombok. – JackboyPlay Jun 16 '21 at 11:51

1 Answers1

0

You should use netty 4.1.x (use the latest release). What you see here is the result of a classpath issue.

Norman Maurer
  • 23,104
  • 2
  • 33
  • 31