This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new f0b4afa  ARTEMIS-2714 log details for 'Address already in use'
     new 71987db  This closes #3083
f0b4afa is described below

commit f0b4afa67248d79a3595601f0296c78c84e3ee7f
Author: Justin Bertram <[email protected]>
AuthorDate: Wed Apr 15 13:48:57 2020 -0500

    ARTEMIS-2714 log details for 'Address already in use'
    
    Currently when the broker hits the common 'Address already in use' issue
    when starting the process terminates with a vague exception. The user is
    left to guess which acceptor actually failed. If the broker has lots of
    acceptors it is a tedious process to identify the problematic
    configuration. This commit adds details to the exception message about
    which acceptor failed and which host:port it was attempting to bind to.
---
 .../activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java   | 7 ++++++-
 .../apache/activemq/artemis/core/server/ActiveMQMessageBundle.java | 3 +++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java
index a528099..3b0234b 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java
@@ -661,7 +661,12 @@ public class NettyAcceptor extends AbstractAcceptor {
          } else {
             address = new InetSocketAddress(h, port);
          }
-         Channel serverChannel = 
bootstrap.bind(address).syncUninterruptibly().channel();
+         Channel serverChannel = null;
+         try {
+            serverChannel = 
bootstrap.bind(address).syncUninterruptibly().channel();
+         } catch (Exception e) {
+            throw ActiveMQMessageBundle.BUNDLE.failedToBind(getName(), h + ":" 
+ port, e);
+         }
          serverChannelGroup.add(serverChannel);
       }
    }
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
index 4d68504..53bf020 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
@@ -485,4 +485,7 @@ public interface ActiveMQMessageBundle {
 
    @Message(id = 229229, value = "Failed to parse JSON queue configuration: 
{0}", format = Message.Format.MESSAGE_FORMAT)
    IllegalArgumentException failedToParseJson(String json);
+
+   @Message(id = 229230, value = "Failed to bind acceptor {0} to {1}", format 
= Message.Format.MESSAGE_FORMAT)
+   IllegalStateException failedToBind(String acceptor, String hostPort, @Cause 
Exception e);
 }

Reply via email to