How Can We Help?
Installation and Windows Service Setup Guide
WildFly requires a Java Development Kit. We'll be using JDK 8.
- Download: Get JDK 8 from the Oracle archive. You'll likely need an Oracle account to download it: https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html
- Install: Run the installer and choose an installation path, for example, C:\Program Files\Java\jdk1.8.0_361.
- Set JAVA_HOME:
- Create a new system variable named JAVA_HOME.
- Set its value to your JDK installation path (e.g., C:\Program Files\Java\jdk1.8.0_361).
- Update System PATH: Add %JAVA_HOME%\bin to your system's Path environment variable. This allows you to run Java commands from any directory.
- Verify: Open a Command Prompt and run java -version. You should see details about your installed JDK.
Next, download the WildFly application server.
- Download: Get WildFly 10.1.0.Final from the official WildFly website or use the direct download link:
- Extract: Unzip the downloaded file to a location like C:\wildfly-10.1.0.Final.
Similar to JAVA_HOME, setting WILDFLY_HOME makes it easier to manage your WildFly installation.
- Set WILDFLY_HOME:
- Create a new system variable named WILDFLY_HOME.
- Set its value to your WildFly extraction path (e.g., C:\wildfly-10.1.0.Final).
- Update System PATH: Add %WILDFLY_HOME%\bin to your system's Path environment variable.
To access the WildFly administration console, you need to create a management user.
- While in the %WILDFLY_HOME%\bin directory in your Command Prompt, run: add-user.bat
- When prompted, choose option a to create a management user.
- Follow the prompts to enter a username and password for your new management user.
- After creating the user, restart WildFly for the changes to take effect. You can do this by closing the current WildFly Command Prompt window and running standalone.bat again, or by pressing Ctrl+C in the WildFly window and then restarting.
By default, WildFly only listens on localhost. If you want to access WildFly from other machines on your network, you need to configure it to listen on all network interfaces.
- Edit standalone.xml: Open the file located at %WILDFLY_HOME%\standalone\configuration\standalone.xml in a text editor.
- Change inet-address: Look for the following lines and change the value of inet-address to 0.0.0.0 for both the public and management interfaces:
XML
<interface name="public">
<inet-address value="${jboss.bind.address:0.0.0.0}"/>
</interface>
<interface name="management">
<inet-address value="${jboss.bind.address.management:0.0.0.0}"/>
</interface>
- Start WildFly with binding: To activate these changes when running manually, start WildFly with the following commands:
standalone.bat -b=0.0.0.0 -bmanagement=0.0.0.0
Setting WildFly as a Windows service ensures it starts automatically when your system boots and runs in the background.
- Open Command Prompt as an Administrator.
- Navigate to the service directory: cd %WILDFLY_HOME%\bin\service
- Install the service: Run: service.bat install
- Start the service: Run: net start WildFly
- Open the Services manager by typing services.msc in the Run dialog (Windows Key + R) or searching for "Services" in the Start Menu.
- Locate the service named 'WildFly'.
- Right-click on 'WildFly' and select Properties.
In the 'General' tab, change the Startup type to 'Automatic'. Click 'Apply' and 'OK'.
You can customize the WildFly service's behavior by editing the wildfly.conf file located at %WILDFLY_HOME%\bin\service\wildfly.conf. This file allows you to adjust JVM options, specify paths, and configure other service-related settings.
If you need to remove the WildFly Windows service, open an Administrator Command Prompt and navigate to %WILDFLY_HOME%\bin\service. Then, run:
service.bat uninstall
By default, WildFly uses port 8080 for its HTTP listener and 9990 for its management console. To deploy WildFly on different ports, you need to modify its configuration file, standalone.xml.
The standalone.xml file, located at %WILDFLY_HOME%\standalone\configuration\standalone.xml, contains the configuration for WildFly's standalone mode. Within this file, you'll find a <sockets> subsystem that defines the various ports WildFly uses.
Here's what you'd typically need to change:
- HTTP/HTTPS Ports (Web Application Access):
- Look for the default-bindings socket binding group.
- Find the <socket-binding name="http" port="${jboss.http.port:8080}"/> entry.
- Change the port value to your desired HTTP port. For example, to change it to 80:
XML
<socket-binding name="http" port="${jboss.http.port:80}"/>
- Similarly, for HTTPS (if configured), find <socket-binding name="https" port="${jboss.https.port:8443}"/> and change its port.
- Management Console Port:
- Look for the <socket-binding name="management-http" port="${jboss.management.http.port:9990}"/> entry.
- Change the port value to your desired management console port. For example, to change it to 9090:
XML
<socket-binding name="management-http" port="${jboss.management.http.port:9090}"/>
- There's also a management-https port if you use HTTPS for the management console.
Example of Port Changes in standalone.xml:
XML
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
<socket-binding name="http" port="${jboss.http.port:80}"/> <socket-binding name="https" port="${jboss.https.port:443}"/> <socket-binding name="management-http" port="${jboss.management.http.port:9090}"/> <socket-binding name="management-https" port="${jboss.management.https.port:9443}"/>
<socket-binding name="txn-default" port="${jboss.txn.default.port:4712}"/>
<socket-binding name="txn-recovery-environment" port="${jboss.txn.recovery.environment.port:4713}"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
</socket-binding-group>
Using Port Offset:
WildFly also provides a convenient way to change all default ports by a specific offset using the port-offset system property. This is particularly useful when running multiple WildFly instances on the same machine.
You can specify the port-offset when starting WildFly:
- Manually:
standalone.bat -Djboss.socket.binding.port-offset=100 (This would change 8080 to 8180, 9990 to 10090, etc.)
- As a Windows Service:
You'd typically modify the wildfly.conf file (located at %WILDFLY_HOME%\bin\service\wildfly.conf). Add or modify the JAVA_OPTS line to include the port offset:
# Sample wildfly.conf entry
JAVA_OPTS="-Djboss.socket.binding.port-offset=100"
After making any port changes, remember to restart WildFly (or its Windows service) for the new port configurations to take effect. If you're running a firewall, ensure that the new ports are open and accessible.