netty5 linux异常,的Netty服务器关闭异常

我已经习惯了下面的代码来处理服务器关机:的Netty服务器关闭异常

public void stop() {

try {

this.channelFuture.channel().close();

this.channelFuture.channel().closeFuture().sync();

} catch (InterruptedException e) {

Log.exceptionStack(e);

} finally {

this.bootstrap.config().childGroup().shutdownGracefully(10, 30, TimeUnit.SECONDS);

this.bootstrap.config().group().shutdownGracefully(5, 10, TimeUnit.SECONDS);

}

}

有时服务器shutsdown以下情况例外:

Exception in thread "nioEventLoopGroup-3-1" java.lang.NoClassDefFoundError: io/netty/buffer/PoolArena$1

at io.netty.buffer.PoolArena.freeChunk(PoolArena.java:293)

at io.netty.buffer.PoolThreadCache$MemoryRegionCache.freeEntry(PoolThreadCache.java:471)

at io.netty.buffer.PoolThreadCache$MemoryRegionCache.free(PoolThreadCache.java:441)

at io.netty.buffer.PoolThreadCache$MemoryRegionCache.free(PoolThreadCache.java:433)

at io.netty.buffer.PoolThreadCache.free(PoolThreadCache.java:290)

at io.netty.buffer.PoolThreadCache.free(PoolThreadCache.java:281)

at io.netty.buffer.PoolThreadCache.free0(PoolThreadCache.java:254)

at io.netty.buffer.PoolThreadCache.free(PoolThreadCache.java:250)

at io.netty.buffer.PooledByteBufAllocator$PoolThreadLocalCache.onRemoval(PooledByteBufAllocator.java:431)

at io.netty.buffer.PooledByteBufAllocator$PoolThreadLocalCache.onRemoval(PooledByteBufAllocator.java:408)

at io.netty.util.concurrent.FastThreadLocal.remove(FastThreadLocal.java:226)

at io.netty.util.concurrent.FastThreadLocal.removeAll(FastThreadLocal.java:67)

at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:146)

at java.lang.Thread.run(Thread.java:745)

Caused by: java.lang.ClassNotFoundException: io.netty.buffer.PoolArena$1

at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

... 14 more

Exception in thread "Thread-1" java.lang.NoClassDefFoundError: io/netty/channel/AbstractChannelHandlerContext$13

at io.netty.channel.AbstractChannelHandlerContext.close(AbstractChannelHandlerContext.java:610)

at io.netty.channel.AbstractChannelHandlerContext.close(AbstractChannelHandlerContext.java:465)

at io.netty.channel.DefaultChannelPipeline.close(DefaultChannelPipeline.java:964)

at io.netty.channel.AbstractChannel.close(AbstractChannel.java:234)

at co.gps.smaartly.TrackerServer.stop(TrackerServer.java:59)

at co.gps.smaartly.ServerManager.stop(ServerManager.java:90)

at co.gps.smaartly.App$1.run(App.java:22)

Caused by: java.lang.ClassNotFoundException: io.netty.channel.AbstractChannelHandlerContext$13

at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

... 7 more

我使用的网状版本4.1.9。最终在JVM版本:

java version "1.8.0_121"

Java(TM) SE Runtime Environment (build 1.8.0_121-b13)

Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

在Ubuntu 16.04

请帮我在这里找出问题。让我知道是否需要其他细节。

2017-04-01

sshntt

+0

你在你的pom依赖中使用netty-all吗? –

+0

关闭服务器时,该jar是否仍然加载?一些jar部署系统在关闭服务器之前替换jar文件。如果你有一个系统,在写一个新文件之前删除这个文件,因为在Linux上这意味着旧文件仍然正常加载 –

+0

@DmitrySoroka我已经在pom依赖文件中包含了netty-all –

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值