2012-10-29 28 views
13

Ich versuche activemq in meiner Anwendung zu verwenden, aber halte einen Fehler bekommen, wenn ich versuche, und eine Verbindung zu localhost:ActiveMQ Verbindung abgelehnt

log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment). 
log4j:WARN Please initialize the log4j system properly. 
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 
Exception in thread "main" org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused 
    at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316) 
    at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168) 
    at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:469) 
    at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:534) 
    at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:526) 
    at sender.MessageSender.sendMessage(MessageSender.java:16) 
    at sender.SenderMain.main(SenderMain.java:13) 
Caused by: javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused 
    at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35) 
    at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:293) 
    at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:238) 
    at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:184) 
    at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184) 
    at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:456) 
    ... 4 more 
Caused by: java.net.ConnectException: Connection refused 
    at java.net.PlainSocketImpl.socketConnect(Native Method) 
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351) 
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213) 
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200) 
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432) 
    at java.net.Socket.connect(Socket.java:529) 
    at org.apache.activemq.transport.tcp.TcpTransport.connect(TcpTransport.java:504) 
    at org.apache.activemq.transport.tcp.TcpTransport.doStart(TcpTransport.java:467) 
    at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:55) 
    at org.apache.activemq.transport.AbstractInactivityMonitor.start(AbstractInactivityMonitor.java:132) 
    at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:58) 
    at org.apache.activemq.transport.WireFormatNegotiator.start(WireFormatNegotiator.java:72) 
    at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:58) 
    at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:58) 
    at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:273) 
    ... 8 more 

Es ist eine Datei, die ausgeführt werden soll, um es zu starten (active mq) und das ist eine .bat Datei auf Windows-Maschinen. Wenn Sie es ausführen, wird es gestartet und Sie lassen es in der Eingabeaufforderung ausgeführt.

Zu Hause habe ich einen Mac und unter Verwendung des mac äquivalent das Terminal nur druckt:

Last login: Mon Oct 29 19:57:15 on ttys000 
(null):~ rickilambert$ /Users/rickilambert/Downloads/apache-activemq-5.7.0/bin/macosx/activemq ; exit; 
Usage: /Users/rickilambert/Downloads/apache-activemq-5.7.0/bin/macosx/activemq { console | start | stop | restart | status | dump } 
logout 

[Process completed] 

Kann mir jemand bitte helfen, dieses Ding zum Laufen zu bekommen?

+0

Ähm, es sagt Ihnen genau, was das Problem ist. 'Verwendung:' ist kein Vorschlag. 'activemq Start' –

+1

@BrianRoach Ich denke, das OP präsentiert die Verwendung von seiner Mac OS Maschine, das Problem ist auf Windows. – dan

+0

@dan - Er versucht activemq auf seinem Mac zu starten. Er tut es nicht und ignoriert die Nachricht, die ihm sagt, wie. Und da er es nicht gestartet hat, kann seine Anwendung keine Verbindung zu ihm herstellen. –

Antwort

11

Ihre Anwendung kann keine Verbindung mit activemq herstellen. Überprüfen Sie, ob Ihr activemq auf localhost 61616 läuft und abhört.

Sie können versuchen, mit: netstat -a zu überprüfen, ob der activemq-Prozess gestartet wurde. Oder versuchen Sie, wenn Sie Ihre actvemq mit Admin-Seite zugreifen können: localhost: 8161/admin/queues.jsp

auf dem Mac werden Sie beginnen Ihre activemq mit:

$ACTMQ_HOME/bin/activemq start 

Oder wenn Ihre Konfigurationsdatei (activemq. xml), wenn an einem anderen Ort befindet, können Sie verwenden:

$ACTMQ_HOME/bin/activemq start xbean:file:${location_of_your_config_file} 

in Ihrem Fall die ausführbare Datei ist unter: bin/macosx/activemq so müssen Sie verwenden: $ACTMQ_HOME/bin/macosx/activemq start

+0

Entschuldigung, ein königlicher Schmerz in den Arsch zu sein, aber ich bekomme keine solche Datei oder kein Verzeichnis, obwohl ich keine Datei dort bin – Biscuit128

+0

@SkyR Gerade jetzt habe ich festgestellt, dass Ihre ausführbare Datei unter: "bin/macosx/activemq". Ich habe meine Antwort aktualisiert. – dan

+0

lol danke. Das hat einen kleinen Unterschied gemacht. Es schlägt vor, dass es jetzt läuft, aber ich bekomme immer noch die selbe Ausnahme (null): macosx rickilambert $ ./activemq start Starten von ActiveMQ Broker ... – Biscuit128

5

stieß ich auf ein ähnliches Problem, wenn ich die unter Verwendung wurde Connection Factory ConnectionFactory- Fabrik zu erhalten = new
ActiveMQConnectionFactory("admin","admin","tcp://:61616");

Sein aufgelöst, wenn ich es auf die unten

geändert

ConnectionFactory factory = new ActiveMQConnectionFactory("tcp://:61616");

Die unten dann zeigte dass meine Q-Größe zunahm .. http://:8161/admin/queues.jsp

0

Ich hatte auch ähnliches Problem. In meinem Fall war brokerUrl nicht richtig konfiguriert. Also auf diese Weise ist erhielt ich Fehler folgende:

Cause: Error While attempting to add new Connection to the pool: nested exception is javax.jms.JMSException: Could not connect to broker URL : tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused 

& ich gelöst es folgt.

ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); 

    connectionFactory.setBrokerURL("tcp://hostname:61616"); 
    connectionFactory.setUserName("admin"); 
    connectionFactory.setPassword("admin"); 
Verwandte Themen