2012-07-28 26 views
12

如何解決錯誤?Activemq由於地址已在使用中而無法運行錯誤

Java Runtime: Oracle Corporation 1.7.0_05 E:\Program Files\Java\jdk1.7.0_05\jre 
    Heap sizes: current=1004928k free=994439k max=1004928k 
    JVM args: -Dcom.sun.management.jmxremote -Xms1G -Xmx1G -Djava.util.logging.config.file=logging.properties -Dactivemq.classpath=F:\workspace\Eclipse java\destinytalk\DestinyServer\apache-activemq-5.6.0\bin\..\conf;F:\workspace\Eclipse java\destinytalk\DestinyServer\apache-activemq-5.6.0\bin\../conf;F:\workspace\Eclipse java\destinytalk\DestinyServer\apache-activemq-5.6.0\bin\../conf; -Dactivemq.home=F:\workspace\Eclipse java\destinytalk\DestinyServer\apache-activemq-5.6.0\bin\.. -Dactivemq.base=F:\workspace\Eclipse java\destinytalk\DestinyServer\apache-activemq-5.6.0\bin\.. -Dactivemq.conf=F:\workspace\Eclipse java\destinytalk\DestinyServer\apache-activemq-5.6.0\bin\..\conf -Dactivemq.data=F:\workspace\Eclipse java\destinytalk\DestinyServer\apache-activemq-5.6.0\bin\..\data -Djava.io.tmpdir=F:\workspace\Eclipse java\destinytalk\DestinyServer\apache-activemq-5.6.0\bin\..\data\tmp 
ACTIVEMQ_HOME: F:\workspace\Eclipse java\destinytalk\DestinyServer\apache-activemq-5.6.0\bin\.. 
ACTIVEMQ_BASE: F:\workspace\Eclipse java\destinytalk\DestinyServer\apache-activemq-5.6.0\bin\.. 
ACTIVEMQ_CONF: F:\workspace\Eclipse java\destinytalk\DestinyServer\apache-activemq-5.6.0\bin\..\conf 
ACTIVEMQ_DATA: F:\workspace\Eclipse java\destinytalk\DestinyServer\apache-activemq-5.6.0\bin\..\data 
Loading message broker from: xbean:activemq.xml 
INFO | Refreshing [email protected]: startup date [Sat Jul 28 18:10:38 CST 2012]; root of context hierarchy 
INFO | PListStore:[F:\workspace\Eclipse java\destinytalk\DestinyServer\apache-activemq-5.6.0\bin\..\data\localhost\tmp_storage ] started 
INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[F:\workspace\Eclipse java\destinytalk\DestinyServer\apache-activemq-5.6.0\bin\..\data\kahadb] 
INFO | KahaDB is version 4 
INFO | Recovering from the journal ... 
INFO | Recovery replayed 1 operations from the journal in 0.071 seconds. 
INFO | ActiveMQ 5.6.0 JMS Message Broker (localhost) is starting 
INFO | For help or more information please see: http://activemq.apache.org/ 
ERROR | Failed to start ActiveMQ JMS Message Broker (localhost, null). Reason: java.io.IOException: Transport Connector could not be registered in JMX: Failed to bind to server socket: tcp://0.0.0.0:61616 due to: java.net.BindException: Address already in use: JVM_Bind 
java.io.IOException: Transport Connector could not be registered in JMX: Failed to bind to server socket: tcp://0.0.0.0:61616 due to: java.net.BindException: Address already in use: JVM_Bind 
    at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27) 
    at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:1836) 
    at org.apache.activemq.broker.BrokerService.startTransportConnector(BrokerService.java:2327) 
    at org.apache.activemq.broker.BrokerService.startAllConnectors(BrokerService.java:2243) 
    at org.apache.activemq.broker.BrokerService.start(BrokerService.java:551) 
    at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:60) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:601) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485) 
+2

提問時,您應該添加更多的上下文。 – 2012-07-28 11:10:08

+1

這些答案有幫助嗎?如果是的話,你應該接受一個。 – snowe 2014-04-18 20:37:14

回答

4

錯誤是告訴你,有或者已經經紀人正在運行或正在使用的ActiveMQ想它的TCP傳輸和JMX服務綁定所需的端口其他一些服務運行。您可以在錯誤字符串「無法綁定到服務器套接字:tcp://0.0.0.0:61616,由於:java.net.BindException:地址已在使用中:」和「無法在JMX中註冊傳輸連接器」 :無法綁定到服務器套接字:tcp://0.0.0.0:61616由於:java.net.BindException:地址已在使用中:「

要解決此問題,您需要弄清楚什麼運行是使用這些端口或更改配置以使用其他端口

+1

我錯誤與其他端口「61613」和「61614」我改變他們爲「6613」和「6614」它對我很好 – Mateen 2014-12-18 19:21:41

5

轉至installation_folder/conf文件夾並打開activemq.xml文件。在文件上查找傳輸連接器。您可以從那裏更改端口值。我將其從61616更改爲6616.通過運行netstat -ao命令,我無法查看在Windows中使用它的過程。

<transportConnectors> 
     <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB --> 
     <transportConnector name="openwire" uri="tcp://0.0.0.0:6616?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/> 
    </transportConnectors> 
+0

在我的情況下,它是使用端口的Visual Studio。關閉它刪除了錯誤。最好在所有服務器啓動後打開其他應用程序。 – myuce 2017-09-15 06:24:08

+0

加1用於提及配置文件。 – 2018-01-19 21:56:48

28

如果您使用的是Windows 7,請嘗試禁用「Internet連接共享(ICS)」服務。

+1

雖然其他答案可以幫助您以通用方式解決問題,但我發現這是問題所在。 ICS運行在與AMQ相同的端口上,因此如果您嘗試共享連接,請與您的移動設備通話,然後使用AMQ,您會發現此錯誤,原因不明。 – 2013-08-23 13:51:22

+0

我有同樣的問題,我可以證實這個答案也幫助我解決了這個問題。 – 2016-09-30 12:17:40

0

這裏的Windows: 軟件與經紀人溝通了大概硬編碼端口,所以我不能改變activemq.xml中

我曾在連接共享打開了其中一個連接,我已禁用它,它的幫助,巨大的問題斌S這個信息作爲netstat沒有顯示這個端口被佔用!

4

我有錯誤面臨同樣的問題:

ERROR |無法啓動ActiveMQ JMS Message Broker(localhost,null)。原因:java.io.IOException:傳輸連接器無法在JMX中註冊:無法綁定到服務器套接字:tcp://0.0.0.0:61616由於:java.net.BindException:地址已在使用中

以下步驟可能有用:

  1. 找到使用此端口的進程ID(在您的情況下,61616)。在命令promt中寫入:netstat -a -o -n並查看進程ID。
  2. 接着殺從任務管理器或TASKKILL/F/PID 「進程id」 的過程

http://sourcecode-kk.blogspot.in/2013/02/kill-process-running-on-certain-port-in.html

乾杯。

0

當在Windows Server 2012R2主機上部署基於Apache Camel的應用程序的嵌入式活動MQ代理時,我遇到了此問題。我遵循上面貼出的建議並更改了代理綁定的端口(從61616到6616)

0

當我們遇到此問題時,我們發現默認端口(61616)位於「臨時端口」 (請參閱https://en.wikipedia.org/wiki/Ephemeral_port瞭解一些背景知識)。我的理解是,操作系統(在我們的例子中是Windows 2012)只要沒有被使用就可以將端口分配給任何想要的。對於我們來說,大多數情況下都沒問題,但偶爾在啓動服務器時,Windows在啓動activemq之前將端口61616分配給其他端口,所以當activemq試圖啓動時,我們得到了這個錯誤。

以下摘錄自「http://blogs.technet.com/b/askds/archive/2007/08/24/dynamic-client-ports-in-windows-server-2008-and-windows-vista-or-how-i-learned-to-stop-worrying-and-love-the-iana.aspx」,其中討論瞭如何設置臨時端口範圍在Windows拍攝(本文稱之爲「動態端口」):

在Vista和2008年的事情大多數管理在網絡堆棧級別通過NETSH進行處理。使用Netsh,有可能看到你的動態端口範圍設置爲在每個服務器的基礎:

netsh int ipv4 show dynamicport tcp

netsh int ipv4 show dynamicport udp

netsh int ipv6 show dynamicport tcp

netsh int ipv6 show dynamicport udp

這些命令將輸出動態端口範圍目前正在使用。一個簡單的事實是,你可以有不同的TCP和UDP範圍,或者IPv4和IPv6,儘管它們的開始都是一樣的。

在Windows Server 2003中,範圍始終默認爲以TCP端口1024開始,並且是硬編碼的。但在Vista/2008中,您可以移動範圍的起始點。因此,如果需要,可以告訴服務器使用端口5000到15000進行動態端口分配,或者使用任何連續的端口範圍。要做到這一點,你再次使用NETSH:以上

netsh int ipv4 set dynamicport tcp start=10000 num=1000

netsh int ipv4 set dynamicport udp start=10000 num=1000

netsh int ipv6 set dynamicport tcp start=10000 num=1000

netsh int ipv4 set dynamicport udp start=10000 num=1000

的例子將設置您的動態端口範圍,開始在10000端口和經歷端口11000(1000端口)。

瞭解的端口範圍有幾個重要的事情:

  • 可以設置端口的最小範圍爲255

  • 的最低起始端口可以設置爲1025

  • 最高端端口(根據您設定的範圍內)不能超過65535

欲瞭解更多信息,請查看KB 929851

+0

是否有可能由於連接到給定端口的客戶端進程鎖定端口?我有這樣的設置並重新啓動客戶端(在我的情況下servicemix)使服務器(activemq)能夠重新啓動。 – 2018-03-01 15:40:38

2

使用錯誤日誌中的端口號找到進程ID。

fuser [port number]/tcp 

然後使用kill -9 [pid]殺死該進程。

+0

非常感謝。這有助於調試! – daemon12 2016-05-12 12:12:15

0

嘗試使用管理員權限運行它。

在windows-轉到目錄-apache-activemq-5.4.3 \ bin並右鍵單擊activemq.bat並以管理員身份運行。

Cheers

0

如果您使用的是java代碼。試試像這樣的支票。

 if (!brokerService.isStarted()) { 
      System.out.println("Bringing up the ActiveMQ Broker"); 
      brokerService.addConnector("tcp://localhost:61616"); 
      brokerService.setBrokerName("Broker"); 
      brokerService.setUseJmx(true); 
      brokerService.start(); 
     } else { 
      System.out.println("ActiveMQ Broker already started"); 
     } 
0

上述職位均有效,改變openwire端口6616的工作,但因爲發生在我身上AMQP端口也被佔領了,這樣你們還需要改變(從5672到5762這可能發生在你身上(或任何根據我的除外))的配置是: -

<transportConnector name="openwire" uri="tcp://0.0.0.0:6616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
     <transportConnector name="amqp" uri="amqp://0.0.0.0:5762?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
     <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
     <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
     <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
0

我有同樣的問題,它似乎端口被另一個JVM使用AMQ連接(ServiceMix的爲AMQ服務的客戶端)堵塞。

重新啓動ServiceMix會解鎖端口預留和ActiveMQ服務重新啓動而不會出現問題。

請注意,舊的ActiveMQ進程不再運行,這似乎是兩個JVM和Windows在客戶端仍然使用它時阻塞該端口的限制。這不是因爲兩個實例試圖同時啓動。

這也許不能解答您的具體問題,但它也可以幫助其他人擁有相同的設置。

相關問題