MessageBroker.getMessageBroker(null)获取空指针异常

时间:2010-06-12 10:16:54

标签: flex

我正在创建动态目的地

MessageBroker broker = MessageBroker.getMessageBroker(null);

        MessageService service = (MessageService) broker.getService("message-service");
        MessageDestination destination = (MessageDestination) service.createDestination("Group1");

        if (service.isStarted()) {
            destination.start();
        }

但我得到Null Pointer Exception MessageBroker broker = MessageBroker.getMessageBroker(null);

任何人都可以帮助我

1 个答案:

答案 0 :(得分:0)

您可能正在使用Spring blazeds集成。默认情况下,Flex使用"__default__"作为messageBroker id,在这种情况下,MessageBroker.getMessageBroker(null)成立。但是,Spring使用"_messageBroker"作为代理ID。因此,您可能必须使用

MessageBroker broker=MessageBroker.getMessageBroker("_messageBroker");

此网址表示更好......

http://forum.springsource.org/showthread.php?t=72964

MessageBroker broker=MessageBroker.getMessageBroker(BeanIds.MESSAGE_BROKER);