Port already in use: 1099 warning when starting ActiveMQ Artemis

55 Views Asked by At

When I try to start an ActiveMQ Artemis server I am getting a warning and exception stack trace as shown below. However, I do not see any process using the port 1099 before starting the server. Surprisingly, this did not stop the server from starting. When I check the netstat after the start of server I can see the port is being listened to.

$ netstat -tuln | grep 1099
tcp6       0      0 :::1099                 :::*                    LISTEN

Is there any thing I am doing wrong?

2024-03-12 14:00:42,293 WARN  [org.apache.activemq.artemis.core.server] AMQ222297: Unable to start Management Context, RBAC not available
java.rmi.server.ExportException: Port already in use: 1099; nested exception is:
        java.net.BindException: Address already in use
        at java.rmi/sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:346) ~[?:?]
        at java.rmi/sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:243) ~[?:?]
        at java.rmi/sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:412) ~[?:?]
        at java.rmi/sun.rmi.transport.LiveRef.exportObject(LiveRef.java:147) ~[?:?]
        at java.rmi/sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:232) ~[?:?]
        at java.rmi/sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:220) ~[?:?]
        at java.rmi/sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:180) ~[?:?]
        at java.rmi/sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:151) ~[?:?]
        at java.rmi/java.rmi.registry.LocateRegistry.createRegistry(LocateRegistry.java:239) ~[?:?]
        at org.apache.activemq.artemis.core.server.management.RmiRegistryFactory.init(RmiRegistryFactory.java:95) ~[artemis-server-2.32.0.jar:2.32.0]
        at org.apache.activemq.artemis.core.server.management.ManagementConnector.start(ManagementConnector.java:59) ~[artemis-server-2.32.0.jar:2.32.0]
        at org.apache.activemq.artemis.core.server.management.ManagementContext.start(ManagementContext.java:59) ~[artemis-server-2.32.0.jar:2.32.0]
        at org.apache.activemq.artemis.cli.commands.Run$1.preActivate(Run.java:96) [artemis-cli-2.32.0.jar:2.32.0]
        at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.callPreActiveCallbacks(ActiveMQServerImpl.java:3110) [artemis-server-2.32.0.jar:2.32.0]
        at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.initialisePart1(ActiveMQServerImpl.java:3276) [artemis-server-2.32.0.jar:2.32.0]
        at org.apache.activemq.artemis.core.server.impl.PrimaryOnlyActivation.run(PrimaryOnlyActivation.java:70) [artemis-server-2.32.0.jar:2.32.0]
        at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.internalStart(ActiveMQServerImpl.java:727) [artemis-server-2.32.0.jar:2.32.0]
        at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.start(ActiveMQServerImpl.java:617) [artemis-server-2.32.0.jar:2.32.0]
        at org.apache.activemq.artemis.integration.FileBroker.start(FileBroker.java:66) [artemis-cli-2.32.0.jar:2.32.0]
        at org.apache.activemq.artemis.cli.commands.Run.execute(Run.java:130) [artemis-cli-2.32.0.jar:2.32.0]
        at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:219) [artemis-cli-2.32.0.jar:2.32.0]
        at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:165) [artemis-cli-2.32.0.jar:2.32.0]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[?:?]
        at org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:157) [artemis-boot.jar:2.32.0]
        at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:64) [artemis-boot.jar:2.32.0]

Here's my management.xml:

<management-context xmlns="http://activemq.apache.org/schema">
   <connector connector-port="1099"/>
   <authorisation>
      <allowlist>
         <entry domain="hawtio"/>
      </allowlist>
      <default-access>
         <!--
         The "default-access" settings apply to every MBean not explicitly configured
         in the "allowlist" or "role-access" sections
         -->

         <!-- allow read-only access by default -->
         <access method="list*" roles="amq"/>
         <access method="get*" roles="amq"/>
         <access method="is*" roles="amq"/>

         <!-- don't allow write or other operations by default -->
         <!--access method="set*" roles="amq"/-->
         <!--access method="*" roles="amq"/-->
      </default-access>
      <role-access>
         <match domain="org.apache.activemq.artemis">
            <access method="list*" roles="amq"/>
            <access method="get*" roles="amq"/>
            <access method="is*" roles="amq"/>
            <access method="set*" roles="amq"/>
            <!-- Note count and browse are need to access the browse tab in the console -->
            <access method="browse*" roles="amq"/>
            <access method="count*" roles="amq"/>
            <access method="*" roles="amq"/>
         </match>
         <!--example of how to configure a specific object -->
         <!--
         <match domain="org.apache.activemq.artemis" key="subcomponent=queues">
            <access method="list*" roles="view,update,amq"/>
            <access method="get*" roles="view,update,amq"/>
            <access method="is*" roles="view,update,amq"/>
            <access method="set*" roles="update,amq"/>
            <access method="*" roles="amq"/>
         </match>
         -->
      </role-access>
   </authorisation>
</management-context>

And my artemis.profile:

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

ARTEMIS_HOME='/opt/artemis'
ARTEMIS_INSTANCE='/opt/artemis/bin/clustered'
ARTEMIS_DATA_DIR='/opt/artemis/bin/clustered/data'
ARTEMIS_ETC_DIR='/opt/artemis/bin/clustered/etc'
ARTEMIS_OOME_DUMP='/opt/artemis/bin/clustered/log/oom_dump.hprof'

# The logging config will need an URI
# this will be encoded in case you use spaces or special characters
# on your directory structure
ARTEMIS_INSTANCE_URI='file:/opt/artemis/bin/clustered/'
ARTEMIS_INSTANCE_ETC_URI='file:/opt/artemis/bin/clustered/etc/'

# Cluster Properties: Used to pass arguments to ActiveMQ Artemis which can be referenced in broker.xml
#ARTEMIS_CLUSTER_PROPS="-Dactivemq.remoting.default.port=61617 -Dactivemq.remoting.amqp.port=5673 -Dactivemq.remoting.stomp.port=61614 -Dactivemq.remoting.hornetq.port=5446"

# Hawtio Properties
# HAWTIO_ROLE define the user role or roles required to be able to login to the console. Multiple roles to allow can
# be separated by a comma. Set to '*' or an empty value to disable role checking when Hawtio authenticates a user.
HAWTIO_ROLE='amq'

# Java Opts
if [ -z "$JAVA_ARGS" ]; then
    JAVA_ARGS="-XX:AutoBoxCacheMax=20000 -XX:+PrintClassHistogram -XX:+UseG1GC -XX:+UseStringDeduplication -Xms1G -Xmx8G -Dhawtio.disableProxy=true -Dhawtio.realm=activemq -Dhawtio.offline=true -Dhawtio.rolePr$
fi

# Uncomment to enable logging for Safepoint JVM pauses
#
# In addition to the traditional GC logs you could enable some JVM flags to know any meaningful and "hidden" pause
# that could affect the latencies of the services delivered by the broker, including those that are not reported by
# the classic GC logs and dependent by JVM background work (eg method deoptimizations, lock unbiasing, JNI, counted
# loops and obviously GC activity).
#
# Replace "all_pauses.log" with the file name you want to log to.
# JAVA_ARGS="$JAVA_ARGS -XX:+PrintSafepointStatistics -XX:PrintSafepointStatisticsCount=1 -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+LogVMOutput -XX:LogFile=all_pauses.log"

# Uncomment to enable the dumping of the Java heap when a java.lang.OutOfMemoryError exception is thrown
#
# In addition to the traditional GC logs you could enable some JVM flags to know any meaningful and "hidden" pause
# that could affect the latencies of the services delivered by the broker, including those that are not reported by
# the classic GC logs and dependent by JVM background work (eg method deoptimizations, lock unbiasing, JNI, counted
# loops and obviously GC activity).
#
# Replace "all_pauses.log" with the file name you want to log to.
# JAVA_ARGS="$JAVA_ARGS -XX:+PrintSafepointStatistics -XX:PrintSafepointStatisticsCount=1 -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+LogVMOutput -XX:LogFile=all_pauses.log"

# Uncomment to enable the dumping of the Java heap when a java.lang.OutOfMemoryError exception is thrown
# JAVA_ARGS="$JAVA_ARGS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${ARTEMIS_OOME_DUMP}"

# Only enable debug options for the 'run' command
if [ "$1" = "run" ]; then :
    # Uncomment to enable remote debugging
    # DEBUG_ARGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"

    # Uncomment for async profiler
    # DEBUG_ARGS="-XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints"
fi
0

There are 0 best solutions below