我在使用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)
答案 0 :(得分:1)