WildFly fails to start: how to solve it

Do you have issues when starting WildFly ? This tutorial will teach you how to troubleshooting issues when WildFly fails to start.

Let’s see some possible causes of failure in starting WildFly Application Server:

Port already in use:

wildfly not starting

This is one of the most common issues that could happen if you are starting WildFly on a port (8080) that is already used by another WildFly / process.

In order to diagnose which service is potentially blocking your WildFly start up, check out this tutorial: Solving java.net.BindException: Address already in use: JVM_Bind

Unsupported Java version

This issue can happen if you are trying to use a JDK version which is not supported by WildFly or (most likely) older servers like JBoss AS 7.

When this happens, usually the server begins to boot but it freezes the execution.

In order to solve the issue, you have to change to Java version then try to start WildFly/JBoss again. For ubuntu user use following command to change default Java JDK version:

sudo update-alternatives --config java 

This will give you a list output similar to this:

   Selection    Path                                               Priority   Status
  0            /usr/lib/jvm/java-6-oracle/jre/bin/java         1070          auto mode
  1            /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1051          manual mode
* 2            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1069          manual mode
Press enter to keep the current choice[*], or type selection number: 

Address or Host name not available

If you are trying to boot WildFly with an IP Address or Hostname which is not available on your machine, you would typically get as response this error:

10:23:49,063 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("interface" => "public")]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.network.interface.public" => "WFLYSRV0082: failed to resolve interface public"}}

Check on your network interface and /etc/hosts file, which is a valid hostname or IP Address that you can use for the network interfaces of WildFy.

For more details, check also this tutorial: Solving jboss.network.management: failed to resolve interface management

A service is blocking your server start up

WildFly ships with a large set of services. The default ones, however, just rely on basic network settings so it should not happen that the servers hangs at start. Chances are that, if you included extra services, like a Resource Adapter of an Outbound connection to another server, that there is an issue blocking your server start.

The way to get around this issue is to have a Thread dump and analyze what blocked threads are doing.

jstack -l WILDFLY_PID > jstack.out

For example, consider the following dump of a Thread:

"main" prio=10 tid=0x00005ssedt011500 nid=0x4564 runnable [0x0000000070f36000]
   java.lang.Thread.State: RUNNABLE
     at java.net.SocketInputStream.socketRead0(Native Method)
     at java.net.SocketInputStream.read(SocketInputStream.java:129)
     at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
     at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
     at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
     - locked <0x00005ssedt011500> (a java.io.BufferedInputStream)
     at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2265)
     at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2278)
     at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2749)
     at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:779)
     at java.io.ObjectInputStream. (ObjectInputStream.java:279)
     at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:255)
     at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1533)
     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:634)
     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
     at javax.naming.InitialContext.lookup(InitialContext.java:392)

As you can see, the Thread is running but blocked during a Socket Read. At the bottom of the Thread dump, you can see what has initiated the Thread: a JNDI lookup. So you are trying to look up a service which is not providing a response.