Activemq VM协议 - BrokerService错误

时间:2014-05-29 13:08:33

标签: activemq

我在使用VM协议打开与代理服务的连接时收到错误。

        BrokerService broker = new BrokerService();

    try {
        broker.setPersistent(true);
        broker.setUseJmx(false);
        broker.setBrokerName("broker1");
        broker.start();

        while(true){

        }

    } catch (Exception e) {
        e.printStackTrace();
    }

这是我的制片人;

        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://broker1?create=false");
    Connection connection = null;
    Session session = null;
    try {
        connection = connectionFactory.createConnection();
        connection.start();

我收到此错误;

javax.jms.JMSException: Could not create Transport. Reason: java.io.IOException: Broker named 'broker1' does not exist.
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:254)
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:267)
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:239)
at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:185)
at Client.main(Client.java:22)

1 个答案:

答案 0 :(得分:1)

蒂姆,你是对的,连接不是在同一个jvm中创建的。我已经意识到我的错误