Java 无法在activemq服务器中建立连接?

Java 无法在activemq服务器中建立连接?,java,activemq,Java,Activemq,我是activemq服务器的新手。我已经下载了activemq 5.8版本。我使用以下代码创建并向activemq服务器发送消息 private static String url = ActiveMQConnection.DEFAULT_BROKER_URL; private static Connection connection = null; public static boolean testessages(String message){

我是activemq服务器的新手。我已经下载了activemq 5.8版本。我使用以下代码创建并向activemq服务器发送消息

private static String url = ActiveMQConnection.DEFAULT_BROKER_URL;
    private static Connection connection = null;

    public static boolean testessages(String message){

            Session session = null;
            try {
                ConnectionFactory connectionFactory =
                    new ActiveMQConnectionFactory(url);
                connection = connectionFactory.createConnection();
                connection.start();
                session = connection.createSession(false,
                        Session.AUTO_ACKNOWLEDGE);

                Destination destination = session.createQueue("orderjson");
                producer = session.createProducer(destination);
                TextMessage message = session.createTextMessage();
                message.setText(msg);   
                producer.send(message);
                return true;

            } catch (JMSException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } finally {
                try {
                    if(session != null){
                        producer.close();
                        session.close();
                        connection.close();
                    }
                } catch (JMSException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }


            }
            return false;
        }
如果我运行上面的代码,则无法创建连接。调试代码后,问题是,当涉及connection.start时,代码未执行。错误消息

没有螺纹悬挂支架 如何解决这个错误?
请有人帮帮我?

您忘了在ActiveMQConnectionFactory上设置brokerUrl。不确定这是否是唯一的问题…谢谢。我尝试设置brokerUrl后也失败了。再次出现相同的错误。