I am currently working with ActiveMQ and JMS. I am facing the problem that I want to change the port of the ActiveMQ web console (running as localhost on Linux - ubuntu 22). Working on the default port (8161
) is no problem, but when I change the port in the file jetty.xml
the web console does not start (or starts briefly and then stops).
Here are the steps I did (installation path is: /opt/apache-activemq-5.17.1/
)
$ cd opt/apache-activemq-5.17.1/conf
$ sudo nano jetty.xml
Change port from 8161
to 61616
in jetty.xml
:
<bean id="jettyPort" init-method="init-method="start">
<!-- the default port number for the web console -->
<property name="host" value="127.0.0.1"/>
<!--property name="port" value="8161"/>-->
<property name="port" value=61616">
</bean>
After saving and returning I start ActiveMQ:
$ cd /opt/apache-activemq-5.17.1/bin/linux-x86-64
$ ls -l
total 152
-rwxr-xr-x 1 root root 15456 Mai 22 10:07 activemq
-rwxr-xr-x 1 root root 15248 Mai 22 10:07 libwrapper.so
-rwxr-xr-x 1 root root 111027 Mai 22 10:07 wrapper
-rw-r--r-- 1 root root 6730 Mai 22 10:07 wrapper.conf
$ sudo ./activemq start
Starting ActiveMQ Broker...
# Checking the status
$ sudo ./activemq status
ActiveMQ Broker is running (26867).
# Checking the status again (about 2-5 seconds execution last command)
$ sudo ./activemq status
ActiveMQ Broker is not running.
Edit/Solution:
The server did not start because OpenWire is already listening on port 61616
. I have restored the default configurations. If you work with JMS, it is simply possible to access ActiveMQ on the default port 8161
via the browser and send messages with tcp://localhost:61616
in Java. Thanks to the user justin-bertram!
CodePudding user response:
By default ActiveMQ listens on port 61616
for connections from OpenWire clients. See this in activemq.xml
:
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
Therefore, if you change Jetty to also listen on port 61616
either Jetty or ActiveMQ itself will fail to start since only one service can be bound to any specific port at a time.