MDB 在此异常后停止工作

发布于 2024-11-01 17:53:36 字数 5135 浏览 4 评论 0原文

我有一个企业事件驱动的应用程序。 我有 16 个从 JMS 队列读取的 MDB。当我遇到一些不受控制的异常时,我收到此堆栈:

####<Apr 18, 2011 11:47:15 AM CEST> <Error> <WebLogicServer> <sapmop11> <cont0Server11> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1303120035886> <BEA-000337> <[STUCK] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)' h
as been busy for "647" seconds working on the request "weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl@16b13f90", which is more than the configured time (StuckThreadMaxTime) of "600" seconds. Stack trace:
        java.lang.Thread.sleep(Native Method)
        weblogic.ejb.container.internal.JMSPollerManager.waitForPollersToStop(JMSPollerManager.java:82)
        weblogic.ejb.container.internal.JMSConnectionPoller.waitForMessagePollerExit(JMSConnectionPoller.java:795)
        weblogic.ejb.container.internal.JMSConnectionPoller.disconnect(JMSConnectionPoller.java:920)
        weblogic.ejb.container.internal.MDConnectionManager.timerExpired(MDConnectionManager.java:166)
        weblogic.timers.internal.TimerImpl.run(TimerImpl.java:273)
        weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
        weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
>
####<Apr 18, 2011 11:48:15 AM CEST> <Error> <WebLogicServer> <sapmop11> <cont0Server11> <[ACTIVE] ExecuteThread: '9' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1303120095935> <BEA-000337> <[STUCK] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)' h
as been busy for "707" seconds working on the request "weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl@16b13f90", which is more than the configured time (StuckThreadMaxTime) of "600" seconds. Stack trace:
        java.lang.Thread.sleep(Native Method)
        weblogic.ejb.container.internal.JMSPollerManager.waitForPollersToStop(JMSPollerManager.java:82)
        weblogic.ejb.container.internal.JMSConnectionPoller.waitForMessagePollerExit(JMSConnectionPoller.java:795)
        weblogic.ejb.container.internal.JMSConnectionPoller.disconnect(JMSConnectionPoller.java:920)
        weblogic.ejb.container.internal.MDConnectionManager.timerExpired(MDConnectionManager.java:166)
        weblogic.timers.internal.TimerImpl.run(TimerImpl.java:273)
        weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
        weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
>

此后,所有 MDB 停止从队列中读取,并且需要重新启动应用程序。

这是 MDB onMessage 代码:

@Override
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public void onMessage(Message message) {
        OnlineEventMessage<? extends Serializable> eventMessage = null;
        try {
            TextMessage textMessage = (TextMessage) message;
            String stringMessage = textMessage.getText();

            logger.debug("e' stato ricevuto il messaggio {}", stringMessage);
            logger.debug("eventMessageParser {}", onlineEventMessageParser);
            logger.debug("legacyEventMessageService {}", legacyEventMessageService);

            EventMessageAnagrafica anagrafica = anagraficaParser.parse(stringMessage, true);
            String multichannelId = anagrafica.getMultichannelId();

            eventMessage = onlineEventMessageParser.parse(stringMessage, true);

            MDC.put("multichannelId", multichannelId);
            MDC.put("eventType", eventMessage.getEventType().getEventCode());
            legacyEventMessageService.handle(eventMessage);
        } catch (JMSException e) {
            retryJmsTemplate.send(destination, new RedeliveryMessageCreatorUtil(message));
            logger.error("si e' verificato un errore JMS nel processamento dell'evento {}, riaccodamento in corso...", e);
        } catch (RuntimeException e) {
            logger.error("si e' verificata una runtime exception per il messaggio {}", e);

            legacyErrorHandlerService.handle(eventMessage);

        } catch (Exception e) {
            logger.error("si e' verificato un errore inaspettato per il messaggio {}", e);
            if (eventMessage != null && eventMessage.getIdEventMessage() != null) {
                logger.error("Il messaggio gia' presente nelle catene di elaborazione");
                OnlineEventMessage<?> onlineMessage = eventMessageDao.getItemByID(eventMessage.getIdEventMessage());
                if (onlineMessage != null) {
                    onlineMessage.setEventState(EventState.PROCESSING_ERROR);
                    eventMessageDao.updateItem(onlineMessage);
                    eventMessageDao.flush();
                }
            }
            context.setRollbackOnly();
        }
    }

知道吗? 亲切的问候 马西莫

I have an enterprise event-driven application.
I have 16 MDBs that read from a JMS queue. When I got some uncontrolled exceptions I receive this stack :

####<Apr 18, 2011 11:47:15 AM CEST> <Error> <WebLogicServer> <sapmop11> <cont0Server11> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1303120035886> <BEA-000337> <[STUCK] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)' h
as been busy for "647" seconds working on the request "weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl@16b13f90", which is more than the configured time (StuckThreadMaxTime) of "600" seconds. Stack trace:
        java.lang.Thread.sleep(Native Method)
        weblogic.ejb.container.internal.JMSPollerManager.waitForPollersToStop(JMSPollerManager.java:82)
        weblogic.ejb.container.internal.JMSConnectionPoller.waitForMessagePollerExit(JMSConnectionPoller.java:795)
        weblogic.ejb.container.internal.JMSConnectionPoller.disconnect(JMSConnectionPoller.java:920)
        weblogic.ejb.container.internal.MDConnectionManager.timerExpired(MDConnectionManager.java:166)
        weblogic.timers.internal.TimerImpl.run(TimerImpl.java:273)
        weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
        weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
>
####<Apr 18, 2011 11:48:15 AM CEST> <Error> <WebLogicServer> <sapmop11> <cont0Server11> <[ACTIVE] ExecuteThread: '9' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1303120095935> <BEA-000337> <[STUCK] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)' h
as been busy for "707" seconds working on the request "weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl@16b13f90", which is more than the configured time (StuckThreadMaxTime) of "600" seconds. Stack trace:
        java.lang.Thread.sleep(Native Method)
        weblogic.ejb.container.internal.JMSPollerManager.waitForPollersToStop(JMSPollerManager.java:82)
        weblogic.ejb.container.internal.JMSConnectionPoller.waitForMessagePollerExit(JMSConnectionPoller.java:795)
        weblogic.ejb.container.internal.JMSConnectionPoller.disconnect(JMSConnectionPoller.java:920)
        weblogic.ejb.container.internal.MDConnectionManager.timerExpired(MDConnectionManager.java:166)
        weblogic.timers.internal.TimerImpl.run(TimerImpl.java:273)
        weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
        weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
>

After this all the MDBs stop reading from the queue and the application need to be restarted.

This is the MDB onMessage code:

@Override
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public void onMessage(Message message) {
        OnlineEventMessage<? extends Serializable> eventMessage = null;
        try {
            TextMessage textMessage = (TextMessage) message;
            String stringMessage = textMessage.getText();

            logger.debug("e' stato ricevuto il messaggio {}", stringMessage);
            logger.debug("eventMessageParser {}", onlineEventMessageParser);
            logger.debug("legacyEventMessageService {}", legacyEventMessageService);

            EventMessageAnagrafica anagrafica = anagraficaParser.parse(stringMessage, true);
            String multichannelId = anagrafica.getMultichannelId();

            eventMessage = onlineEventMessageParser.parse(stringMessage, true);

            MDC.put("multichannelId", multichannelId);
            MDC.put("eventType", eventMessage.getEventType().getEventCode());
            legacyEventMessageService.handle(eventMessage);
        } catch (JMSException e) {
            retryJmsTemplate.send(destination, new RedeliveryMessageCreatorUtil(message));
            logger.error("si e' verificato un errore JMS nel processamento dell'evento {}, riaccodamento in corso...", e);
        } catch (RuntimeException e) {
            logger.error("si e' verificata una runtime exception per il messaggio {}", e);

            legacyErrorHandlerService.handle(eventMessage);

        } catch (Exception e) {
            logger.error("si e' verificato un errore inaspettato per il messaggio {}", e);
            if (eventMessage != null && eventMessage.getIdEventMessage() != null) {
                logger.error("Il messaggio gia' presente nelle catene di elaborazione");
                OnlineEventMessage<?> onlineMessage = eventMessageDao.getItemByID(eventMessage.getIdEventMessage());
                if (onlineMessage != null) {
                    onlineMessage.setEventState(EventState.PROCESSING_ERROR);
                    eventMessageDao.updateItem(onlineMessage);
                    eventMessageDao.flush();
                }
            }
            context.setRollbackOnly();
        }
    }

Any idea?
Kind regards
Massimo

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦里泪两行 2024-11-08 17:53:36

这似乎是一个交易问题。下次发生这种情况时尝试进行线程转储并查看线程正在做什么。您可以通过管理控制台执行此操作。

This seems like a transaction issue. Try taking a Thread Dump next time this happens and take a look at what the threads are doing. You can do this through the Admin Console.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文