我有一个特殊问题
我开发了一个ServletContextListener,用于在应用程序启动时在队列上创建消息监听器,并在应用程序中停止(接收器,会话和连接)消息监听器,如下所示
public class AppContextListener implements ServletContextListener {
private static JMSQueue updateIssueOrderApprovalQueue;
private static JMSQueue rejectIssueRequestQueue;
public void contextInitialized(ServletContextEvent p1) {
updateIssueOrderApprovalQueue = IssueOrderApprovalOperationsListener.registerUpdateIssueOrderApprovalQueueListener();
rejectIssueRequestQueue = RejectIssueRequestOperationsListener.rejectIssueRequestQueueListener();
}
public void contextDestroyed(ServletContextEvent event) {
try{
if(updateIssueOrderApprovalQueue != null)
updateIssueOrderApprovalQueue.close();
} catch(Exception e){
e.printStackTrace();
}
try{
if(rejectIssueRequestQueue != null)
rejectIssueRequestQueue.close();
} catch(Exception e){
e.printStackTrace();
}
}
}
代码工作正常,没有。当我停止应用程序时,Wildfly控制台中的消费者减少了 但是服务器控制台包含一些奇怪的错误,如下所示
13:56:21,315 ERROR [stderr] (Thread-0 (ActiveMQ-client-netty-threads-805579002)) Exception in thread "Thread-0 (ActiveMQ-client-netty-threads-805579002)" java.lang.NoClassDefFoundError: io/netty/util/concurrent/DefaultPromise$2
13:56:21,316 ERROR [stderr] (Thread-0 (ActiveMQ-client-netty-threads-805579002)) at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:589)
13:56:21,317 ERROR [stderr] (Thread-0 (ActiveMQ-client-netty-threads-805579002)) at io.netty.util.concurrent.DefaultPromise.setSuccess(DefaultPromise.java:397)
13:56:21,317 ERROR [stderr] (Thread-0 (ActiveMQ-client-netty-threads-805579002)) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:151)
13:56:21,317 ERROR [stderr] (Thread-0 (ActiveMQ-client-netty-threads-805579002)) at java.lang.Thread.run(Thread.java:745)
13:56:21,318 ERROR [stderr] (Thread-0 (ActiveMQ-client-netty-threads-805579002)) Caused by: java.lang.ClassNotFoundException: io.netty.util.concurrent.DefaultPromise$2 from [Module "deployment.Finance.war:main" from Service Module Loader]
13:56:21,318 ERROR [stderr] (Thread-0 (ActiveMQ-client-netty-threads-805579002)) at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
13:56:21,318 ERROR [stderr] (Thread-0 (ActiveMQ-client-netty-threads-805579002)) at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
13:56:21,318 ERROR [stderr] (Thread-0 (ActiveMQ-client-netty-threads-805579002)) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
13:56:21,320 ERROR [stderr] (Thread-0 (ActiveMQ-client-netty-threads-805579002)) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
13:56:21,320 ERROR [stderr] (Thread-0 (ActiveMQ-client-netty-threads-805579002)) ... 4 more
13:56:21,749 WARN [io.netty.util.ThreadDeathWatcher] (threadDeathWatcher-2-1) Thread death watcher task raised an exception:: java.lang.NoClassDefFoundError: io/netty/buffer/PoolArena$1
at io.netty.buffer.PoolArena.freeChunk(PoolArena.java:266)
at io.netty.buffer.PoolThreadCache$MemoryRegionCache.freeEntry(PoolThreadCache.java:444)
at io.netty.buffer.PoolThreadCache$MemoryRegionCache.free(PoolThreadCache.java:414)
at io.netty.buffer.PoolThreadCache$MemoryRegionCache.free(PoolThreadCache.java:406)
at io.netty.buffer.PoolThreadCache.free(PoolThreadCache.java:263)
at io.netty.buffer.PoolThreadCache.free(PoolThreadCache.java:254)
at io.netty.buffer.PoolThreadCache.free0(PoolThreadCache.java:235)
at io.netty.buffer.PoolThreadCache.access$000(PoolThreadCache.java:38)
at io.netty.buffer.PoolThreadCache$1.run(PoolThreadCache.java:64)
at io.netty.util.ThreadDeathWatcher$Watcher.notifyWatchees(ThreadDeathWatcher.java:195)
at io.netty.util.ThreadDeathWatcher$Watcher.run(ThreadDeathWatcher.java:130)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: io.netty.buffer.PoolArena$1 from [Module "deployment.Finance.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
... 13 more
13:56:22,556 ERROR [stderr] (Thread-2 (ActiveMQ-client-netty-threads-805579002)) Exception in thread "Thread-2 (ActiveMQ-client-netty-threads-805579002)" java.lang.NoClassDefFoundError: io/netty/util/concurrent/DefaultPromise$2
13:56:22,556 ERROR [stderr] (Thread-2 (ActiveMQ-client-netty-threads-805579002)) at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:589)
13:56:22,556 ERROR [stderr] (Thread-2 (ActiveMQ-client-netty-threads-805579002)) at io.netty.util.concurrent.DefaultPromise.setSuccess(DefaultPromise.java:397)
13:56:22,557 ERROR [stderr] (Thread-2 (ActiveMQ-client-netty-threads-805579002)) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:151)
13:56:22,557 ERROR [stderr] (Thread-2 (ActiveMQ-client-netty-threads-805579002)) at java.lang.Thread.run(Thread.java:745)
13:56:22,747 ERROR [stderr] (Thread-8 (ActiveMQ-client-netty-threads-805579002)) Exception in thread "Thread-8 (ActiveMQ-client-netty-threads-805579002)" java.lang.NoClassDefFoundError: io/netty/util/concurrent/DefaultPromise$2
13:56:22,748 ERROR [stderr] (Thread-8 (ActiveMQ-client-netty-threads-805579002)) at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:589)
13:56:22,748 ERROR [stderr] (Thread-8 (ActiveMQ-client-netty-threads-805579002)) at io.netty.util.concurrent.DefaultPromise.setSuccess(DefaultPromise.java:397)
13:56:22,748 ERROR [stderr] (Thread-8 (ActiveMQ-client-netty-threads-805579002)) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:151)
13:56:22,749 ERROR [stderr] (Thread-8 (ActiveMQ-client-netty-threads-805579002)) at java.lang.Thread.run(Thread.java:745)
13:56:23,101 ERROR [stderr] (Thread-6 (ActiveMQ-client-netty-threads-805579002)) Exception in thread "Thread-6 (ActiveMQ-client-netty-threads-805579002)" java.lang.NoClassDefFoundError: io/netty/util/concurrent/DefaultPromise$2
13:56:23,102 ERROR [stderr] (Thread-6 (ActiveMQ-client-netty-threads-805579002)) at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:589)
13:56:23,102 ERROR [stderr] (Thread-6 (ActiveMQ-client-netty-threads-805579002)) at io.netty.util.concurrent.DefaultPromise.setSuccess(DefaultPromise.java:397)
13:56:23,102 ERROR [stderr] (Thread-6 (ActiveMQ-client-netty-threads-805579002)) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:151)
13:56:23,102 ERROR [stderr] (Thread-6 (ActiveMQ-client-netty-threads-805579002)) at java.lang.Thread.run(Thread.java:745)
13:56:28,757 WARN [io.netty.util.ThreadDeathWatcher] (threadDeathWatcher-2-1) Thread death watcher task raised an exception:: java.lang.NoClassDefFoundError: io/netty/buffer/PoolArena$1
at io.netty.buffer.PoolArena.freeChunk(PoolArena.java:266)
at io.netty.buffer.PoolThreadCache$MemoryRegionCache.freeEntry(PoolThreadCache.java:444)
at io.netty.buffer.PoolThreadCache$MemoryRegionCache.free(PoolThreadCache.java:414)
at io.netty.buffer.PoolThreadCache$MemoryRegionCache.free(PoolThreadCache.java:406)
at io.netty.buffer.PoolThreadCache.free(PoolThreadCache.java:263)
at io.netty.buffer.PoolThreadCache.free(PoolThreadCache.java:254)
at io.netty.buffer.PoolThreadCache.free0(PoolThreadCache.java:235)
at io.netty.buffer.PoolThreadCache.access$000(PoolThreadCache.java:38)
at io.netty.buffer.PoolThreadCache$1.run(PoolThreadCache.java:64)
at io.netty.util.ThreadDeathWatcher$Watcher.notifyWatchees(ThreadDeathWatcher.java:195)
at io.netty.util.ThreadDeathWatcher$Watcher.run(ThreadDeathWatcher.java:130)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
我认为服务器仍然有活动线程等待消息来调用我的监听器,当他检查我的监听器时,线程找不到监听器,因为我已经关闭了服务器和应用程序之间的jms连接。
注意:在服务器中禁用(停止)我的应用程序部署后,错误仅在日志中打印一次。