此异常后,MDB停止工作

时间:2011-04-18 13:17:18

标签: jms weblogic message-driven-bean

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

####<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();
        }
    }

有什么想法吗? 亲切的问候 马西莫

1 个答案:

答案 0 :(得分:0)

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