Sunday, July 24, 2016

WildFly fails to start a service due to bind error - Switching port



>PROBLEM

WildFly fails to start a service throwing the following message:
  Caused by: java.net.BindException: Address already in use: bind




>SOLUTION

Edit the following file:

  $WILDFLY_ROOTDIR\standalone\configuration\standalone.xml
  $WILDFLY_ROOTDIR\standalone\configuration\standalone-full.xml

and switch the ports:

- original value:

    <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
        <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>

- new configuration using an available port:

    <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
        <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9991}"/>


To check if a port is currently unavailable, use netstat command.
Example:
  netstat -nao | grep 9991
If the command returns empty, the port is available (not used).

NOTE:
If using windows, you may use cygwin to make available the grep command.

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...