How to Start Wildfly Java Application Server and listening to all available address as a Foreground Process

Posted on

Introduction

This is another article with a relation with another previous article. Those articles are the article with the title ‘How to Start Wildfly Java Application Server’ in this link and another article with the title ‘How to Start Wildfly Java Application Server in the Background Process’ in this link. This article has similar content with those articles. It is discussing about how to start Wildfly Java Application Server. As an addition, this article aims to offer another condition in running Wildfly Java Application Server. The service must be able to run, listen and accept incoming requests in every available addresses or interfaces in the machine. The following is the command for running Wildfly Java Application Server so it can listen to every incoming requests in every available addresses in the operating system. As an additional description, it run as a foreground process.

1. First of all, switch to root account in order to execute the process as another user. Just execute the following command pattern to switch to root account :

sudo su - root

The following is the command execution using the above command pattern :

user@hostname:~$ sudo su - root
[sudo] password for user: 
root@hostname ~#

2. After successfully switching to root account. The command pattern for executing Wildfly Java Application Server listening to all available addresses exists as follows :

/opt/wildfly-xx.x.x-Final/bin/standalone.sh -b 0.0.0.0 

Just execute the above command pattern as follows :

root@hostname ~# /opt/wildfly-17.0.1.Final/bin/standalone.sh -b 0.0.0.0
=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /opt/wildfly-17.0.1.Final

  JAVA: java

  JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true 

=========================================================================

14:56:19,647 INFO  [org.jboss.modules] (main) JBoss Modules version 1.9.1.Final
14:56:20,023 INFO  [org.jboss.msc] (main) JBoss MSC version 1.4.8.Final
14:56:20,032 INFO  [org.jboss.threads] (main) JBoss Threads version 2.3.3.Final
14:56:20,140 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 17.0.1.Final (WildFly Core 9.0.2.Final) starting
14:56:21,387 INFO  [org.wildfly.security] (ServerService Thread Pool -- 18) ELY00001: WildFly Elytron version 1.9.1.Final
14:56:21,904 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/core-service=management/management-interface=http-interface' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
14:56:21,934 INFO  [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 36) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/subsystem=undertow/server=default-server/https-listener=https' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
14:56:21,995 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
14:56:22,007 INFO  [org.xnio] (MSC service thread 1-1) XNIO version 3.7.2.Final
14:56:22,013 INFO  [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.7.2.Final
14:56:22,069 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 51) WFLYCLINF0001: Activating Infinispan subsystem.
14:56:22,081 INFO  [org.jboss.remoting] (MSC service thread 1-8) JBoss Remoting version 5.0.12.Final
14:56:22,101 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 52) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
14:56:22,102 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 43) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.4)
14:56:22,133 INFO  [org.jboss.as.connector] (MSC service thread 1-7) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.4.16.Final)
14:56:22,134 INFO  [org.wildfly.extension.microprofile.config.smallrye._private] (ServerService Thread Pool -- 60) WFLYCONF0001: Activating WildFly MicroProfile Config Subsystem
14:56:22,140 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 58) WFLYJSF0007: Activated the following JSF Implementations: [main]
14:56:22,142 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) WFLYJCA0018: Started Driver service with driver-name = h2
14:56:22,151 INFO  [org.wildfly.extension.microprofile.opentracing] (ServerService Thread Pool -- 63) WFLYTRACEXT0001: Activating MicroProfile OpenTracing Subsystem
14:56:22,156 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 64) WFLYNAM0001: Activating Naming Subsystem
14:56:22,160 INFO  [org.wildfly.extension.microprofile.metrics.smallrye] (ServerService Thread Pool -- 62) WFLYMETRICS0001: Activating Eclipse MicroProfile Metrics Subsystem
14:56:22,168 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 72) WFLYTX0013: The node-identifier attribute on the /subsystem=transactions is set to the default value. This is a danger for environments running multiple servers. Please make sure the attribute value is unique.
14:56:22,174 INFO  [org.wildfly.extension.microprofile.health.smallrye] (ServerService Thread Pool -- 61) WFLYHEALTH0001: Activating Eclipse MicroProfile Health Subsystem
14:56:22,191 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 70) WFLYSEC0002: Activating Security Subsystem
14:56:22,193 INFO  [org.jboss.as.security] (MSC service thread 1-1) WFLYSEC0001: Current PicketBox version=5.0.3.Final
14:56:22,198 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 74) WFLYWS0002: Activating WebServices Extension
14:56:22,218 INFO  [io.smallrye.metrics] (MSC service thread 1-7) Converted [2] config entries and added [4] replacements
14:56:22,224 INFO  [io.smallrye.metrics] (MSC service thread 1-7) Converted [3] config entries and added [14] replacements
14:56:22,232 INFO  [org.jboss.as.naming] (MSC service thread 1-8) WFLYNAM0003: Starting Naming Service
14:56:22,245 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-7) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
14:56:22,274 INFO  [org.jboss.as.ejb3] (MSC service thread 1-8) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 32 (per class), which is derived from the number of CPUs on this host.
14:56:22,274 INFO  [org.jboss.as.ejb3] (MSC service thread 1-3) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 128 (per class), which is derived from thread worker pool sizing.
14:56:22,416 INFO  [org.jboss.as.jaxrs] (ServerService Thread Pool -- 53) WFLYRS0016: RESTEasy version 3.7.0.Final
14:56:22,442 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0003: Undertow 2.0.21.Final starting
14:56:22,514 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 73) WFLYUT0014: Creating file handler for path '/opt/wildfly-17.0.1.Final/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
14:56:22,519 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0012: Started server default-server.
14:56:22,521 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0018: Host default-host starting
14:56:22,573 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0006: Undertow HTTP listener default listening on 0.0.0.0:8080
14:56:22,595 INFO  [org.jboss.as.ejb3] (MSC service thread 1-1) WFLYEJB0493: EJB subsystem suspension complete
14:56:22,636 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
14:56:22,904 INFO  [org.jboss.as.patching] (MSC service thread 1-5) WFLYPAT0050: WildFly Full cumulative patch ID is: base, one-off patches include: none
14:56:22,918 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-8) WFLYDS0013: Started FileSystemDeploymentService for directory /opt/wildfly-17.0.1.Final/standalone/deployments
14:56:23,067 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0006: Undertow HTTPS listener https listening on 0.0.0.0:8443
14:56:23,134 INFO  [org.jboss.ws.common.management] (MSC service thread 1-8) JBWS022052: Starting JBossWS 5.3.0.Final (Apache CXF 3.3.2) 
14:56:23,220 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
14:56:23,222 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
14:56:23,223 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
14:56:23,223 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 17.0.1.Final (WildFly Core 9.0.2.Final) started in 3883ms - Started 314 of 576 services (369 services are lazy, passive or on-demand)

The above output will stay just like that for Wildfly to continue on running. It is because Wildfly runs in the foreground process. Terminating the command by typing ‘Ctrl+C’ for an example to redirect back to the command line interface will also terminate the Wildfly process.

Checking the Wildfly Java Application Server Service’s Status

According to the output above, Wildfly is currently running. It is running in all available addresses in the machine. The address ‘0.0.0.0’ is representing for all available addresses in the machine. It is because ‘0.0.0.0’ is a broadcast IP address. There is an additional parameter for specifying what addresses should Wildfly listening. According to the help information where it appear on executing the command with additional parameter -h, it is important that -b will set system property jboss.bind.address to the given value. By giving the value of ‘0.0.0.0’, it will set the jboss.bind.address to a broadcast IP address. In the context of servers, 0.0.0.0 means “all IPv4 addresses on the local machine”. For an example machine has two IP addresses, 192.168.1.1 and 10.1.2.1, and a server running on that machine listens on 0.0.0.0, it will be reachable at both of those IPs.

The above execution will keep the log output file running in the command line interface. The reason is because Wildfly Java Application is running in the foreground process. The last thing to do is to check whether the service available after running the process will accept requests in all available address in the machine. Read the article with the title of ‘How to Check Wildfly Java Application Server running service or process’ in this link to know how to check the status of Wildfly Java Application Server’s service.

The following is an example for checking the service’s status :

root@hostname ~# netstat -tulpn | grep 8080
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      6767/java           
root@hostname ~# 
root@hostname ~# netstat -tulpn | grep 9990
tcp        0      0 0.0.0.0:9990            0.0.0.0:*               LISTEN      6767/java           
root@hostname ~# 
root@hostname ~# netstat -tulpn | grep 8443
tcp        0      0 0.0.0.0:8443            0.0.0.0:*               LISTEN      6767/java           
root@hostname ~# 

In summary, according to the output above Wildly uses port 8080, 9990 and 8443 to listen for incoming requests. The above output present information that it listens in all available IP addresses in the machine. The information represents those addresses are in the form of ‘0.0.0.0’.

One thought on “How to Start Wildfly Java Application Server and listening to all available address as a Foreground Process

Leave a Reply