When troubleshooting JBoss/WildFly, common issues usually stem from configuration problems, environment mismatches, and deployment errors. Here’s a guide to help you identify and solve common issues in JBoss/WildFly.
Address already in use
, OutOfMemoryError
, or ClassNotFoundException
.Check if the port is in use:
If WildFly fails to bind to a port (e.g., 8080 or 9990), it’s likely that the port is already in use.
On Linux/macOS:
sudo netstat -tuln | grep 8080
On Windows:
netstat -aon | findstr 8080
To resolve, either stop the conflicting service or change the default port in standalone.xml
.
Increase Java heap memory:
If the server is throwing OutOfMemoryError
, increase the heap memory in the standalone.conf
(Linux/macOS) or standalone.conf.bat
(Windows).
Modify the JAVA_OPTS
as follows:
JAVA_OPTS="-Xms512m -Xmx2048m"
Missing or incorrect dependencies:
If you see ClassNotFoundException
, it might be due to missing JAR files or incorrect versions of libraries in your deployment. Ensure that all required dependencies are included in the WEB-INF/lib
or META-INF/lib
directory of your application.
http://localhost:9990/console
.User authentication issues:
If you are unable to log in to the admin console, ensure that you have correctly created a management user by running:
./add-user.sh
Make sure you are using the correct username and password.
Check port access:
If the admin console is not accessible on localhost:9990
, ensure that the management-http
port is open and bound to the correct IP address in the standalone.xml
:
<socket-binding name="management-http" port="9990"/>
If you’re accessing the server from a remote machine, ensure that the server is bound to the public IP by starting it with:
./standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0
Firewall issues:
Ensure that your firewall is not blocking access to port 9990. On Linux, you can use:
sudo ufw allow 9990
FAILED
state.Check deployment logs:
Review the log files in the standalone/log/server.log
or domain/log/server.log
. Look for specific deployment errors, such as NullPointerException
, UnsatisfiedDependencyException
, or ClassNotFoundException
.
Correct JAR versions:
Ensure that your application is using compatible versions of libraries and that you are not bundling conflicting libraries with your deployment.
Redeploy the application:
If your deployment is stuck, remove it, and redeploy. From the WildFly CLI:
./jboss-cli.sh --connect
undeploy <app-name>
deploy /path/to/your/app.war
Check WEB-INF
and META-INF
directories:
Ensure that your WEB-INF
and META-INF
directories in your .war
file are properly configured. For example, the web.xml
file should be in WEB-INF
, and your persistence configurations should be in META-INF
.
java.lang.OutOfMemoryError: PermGen space
java.lang.OutOfMemoryError: GC overhead limit exceeded
Increase JVM memory limits:
Edit the standalone.conf
(Linux/macOS) or standalone.conf.bat
(Windows) to increase the memory settings for the JVM:
JAVA_OPTS="-Xms1024m -Xmx4096m -XX:MaxMetaspaceSize=1024m"
Check memory leaks:
If your applications are causing memory leaks, use a profiler (like VisualVM or JProfiler) to identify the problematic parts of the code.
Address already in use: bind
.Find and kill the process using the port:
If another process is using the port, you can either kill it or change the WildFly port configuration in standalone.xml
.
To kill a process (Linux/macOS):
sudo lsof -i :8080
sudo kill -9 <process_id>
On Windows:
netstat -aon | findstr 8080
taskkill /F /PID <process_id>
Change port bindings:
Modify the port numbers in standalone.xml
or domain.xml
. Look for the <socket-binding>
section and update as needed:
<socket-binding name="http" port="8080"/>
<socket-binding name="management-http" port="9990"/>
javax.persistence.PersistenceException
Check datasource configuration:
Ensure that the database connection settings in standalone.xml
or domain.xml
are correct. Verify the JDBC driver, URL, username, and password.
Example of a valid datasource configuration:
<datasource jndi-name="java:/jdbc/YourDS" pool-name="YourDS">
<connection-url>jdbc:mysql://localhost:3306/yourdb</connection-url>
<driver>mysql</driver>
<security>
<user-name>dbuser</user-name>
<password>dbpassword</password>
</security>
</datasource>
Check if the database is running:
Ensure the database server is up and running and that it accepts connections from the WildFly host.
JDBC Driver:
Ensure the correct JDBC driver is installed. You can add the driver via the admin console or by placing the driver JAR in the standalone/deployments
directory.
Check logging configuration:
The logging configuration is located in the standalone.xml
file. Ensure that the correct log handlers and log levels are configured under the <subsystem>
section for logging:
<subsystem xmlns="urn:jboss:domain:logging:5.0">
<console-handler name="CONSOLE">
<level name="INFO"/>
<formatter>
<named-formatter name="COLOR-PATTERN"/>
</formatter>
</console-handler>
<logger category="com.yourapp">
<level name="DEBUG"/>
</logger>
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
</handlers>
</root-logger>
</subsystem>
Log rotation:
If logs are getting too large or not rotating, check the <periodic-rotating-file-handler>
configuration in the logging subsystem.