WildFly (formerly JBoss Application Server) is an open-source Java application server used to build, deploy, and manage enterprise-level applications. It implements Jakarta EE standards and provides essential services required for large-scale, production-ready Java systems.
Why Use WildFly:
- Open-source and enterprise ready
- Active community support
- Cloud and container friendly
- Supports latest Jakarta EE standards
Prerequisites:
Before installing WildFly, ensure the following components are installed:
- Java Development Kit (JDK): Recommended → JDK 17 or higher (JDK 11 still works for some versions).
- Apache Maven: Required if you plan to build and deploy applications using Maven.
Step-By-Step: Install and Set Up WildFly Server
Step 1: Download WildFly
- Visit the official WildFly website.
- Download the latest stable release (check website versions now go beyond 35+).
- Extract the ZIP file to a directory such as: C:\wildfly-XX.X.X.Final
This directory is referred to as: WILDFLY_HOME
Step 2: Set Up Environment Variables
Setting up environment variables will simplify access to WildFly from any terminal.
1. Windows:
- Go to "System Properties" > "Advanced System Settings" > "Environment Variables."
- Add a new system variable:
- Variable Name: WILDFLY_HOME
- Variable Value: Path to WildFly installation directory (e.g., C:\wildfly-28.0.0.Final)
- Edit the Path variable and append %WILDFLY_HOME%\bin.
2. Linux/macOS:
Open a terminal and add the following lines to your .bashrc or .bash_profile file:
export WILDFLY_HOME=/path/to/wildfly-28.0.0.Final
export PATH=$PATH:$WILDFLY_HOME/bin
Apply the changes by running source ~/.bashrc.
Step 3: Start WildFly Server
- Open command prompt and navigate to $WILDFLY_HOME/bin.
- Run the following command to start the server:
./standalone.sh
For Windows, use:
standalone.bat
- The server will start, and logs will appear. WildFly runs on the following default ports:
- App → 8080
- Management Console → 9990
Step 4: Access WildFly Management Console
- Open a browser and go to http://localhost:9990.
- If this is the first time accessing the console, create a management user by running:
./add-user.sh
Use add-user.bat on Windows.
- Follow the prompts to create an admin user.
Step 5: Configure WildFly for Maven Integration
WildFly can be integrated with Maven to deploy Java EE applications. This step configures Maven with WildFly’s deployment features.
- Add WildFly Plugin to Maven Project: In your Maven pom.xml file, add the WildFly plugin:
<build>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>3.0.0.Final</version>
</plugin>
</plugins>
</build>
- Deploy an Application Using Maven: To deploy a Java EE application to WildFly, use the following Maven command:
mvn wildfly:deploy
Ensure that your application is packaged as a WAR file in the target directory of your Maven project.
Step 6: Deploy Application
- Open the WildFly management console at http://localhost:9990.
- Click on the "Deployments" tab and choose "Add" to upload a WAR file.
- Select your WAR file and click "Next" to complete the deployment.
Alternatively, you can deploy your application using Maven, as described in the previous step.
Step 7: Common WildFly Configurations
- Change Default HTTP Port: If you need to run WildFly on a different port, modify the standalone.xml file located in $WILDFLY_HOME/standalone/configuration/. Look for the following section and update the port:
<socket-binding name="http" port="8080"/>
- Database Integration: To connect WildFly to a database like MySQL or PostgreSQL, you can configure data sources via the management console:
- Go to: Configuration > Subsystems > Datasources to add a new data source.
- Add:
- MySQL
- PostgreSQL
- Oracle
- Others