How to Start Wildfly Java Application Server using Wildfly User Account to listen to all available address as a Foreground Process

Posted on

Introduction

This article combines the previous articles about starting Wildfly Java Application Server. Those articles are focusing to start Wildfly Java Application Server with different condition. The following list of links  consist of those articles :

1. How to Start Wildfly Java Application Server in the Foreground Process .

  1. How to Start Wildfly Java Application Server in the Background Process .
  2. How to Start Wildfly Java Application Server using Wildfly User Account as a Foreground Process .

  3. How to Start Wildfly Java Application Server using Wildfly User Account as a Background Process .

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

  5. How to Start Wildfly Java Application Server and listening to all available address as a Background Process .

There is an additional specific and different condition about running Wildfly Java Application Server in this article. It is the expansion subject of the articleo¬† with the title of ‘How to Start Wildfly Java Application Server and listening to all available address as a Foreground Process‘. The following is the step for achieving the purpose as it exist in the title of this article :

1. Switch to ‘root’ account. Using the root account, the following is the command pattern to do it :

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

2. After successfully switching to root account, execute the following command pattern :

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

The command runuser will run the rest of the command after as a specific user. In the above pattern, it is running the process as ‘wildfly’ user account. The additional parameter of ‘-c’ is a specific additional parameter for running the command enclosed in the double quote.

The above command execution is in the following output for an example :

root@hostname ~# runuser wildfly -c "/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 

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

16:42:22,076 INFO  [org.jboss.modules] (main) JBoss Modules version 1.9.1.Final
16:42:22,860 INFO  [org.jboss.msc] (main) JBoss MSC version 1.4.8.Final
16:42:22,870 INFO  [org.jboss.threads] (main) JBoss Threads version 2.3.3.Final
16:42:22,977 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 17.0.1.Final (WildFly Core 9.0.2.Final) starting
16:42:26,755 INFO  [org.wildfly.security] (ServerService Thread Pool -- 26) ELY00001: WildFly Elytron version 1.9.1.Final
16:42:28,254 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.
16:42:28,275 INFO  [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 32) 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.
16:42:28,363 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
16:42:28,379 INFO  [org.xnio] (MSC service thread 1-1) XNIO version 3.7.2.Final
16:42:28,385 INFO  [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.7.2.Final
16:42:28,462 INFO  [org.jboss.remoting] (MSC service thread 1-3) JBoss Remoting version 5.0.12.Final
16:42:28,466 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 51) WFLYCLINF0001: Activating Infinispan subsystem.
16:42:28,518 INFO  [org.wildfly.extension.microprofile.config.smallrye._private] (ServerService Thread Pool -- 60) WFLYCONF0001: Activating WildFly MicroProfile Config Subsystem
16:42:28,537 INFO  [org.wildfly.extension.microprofile.opentracing] (ServerService Thread Pool -- 63) WFLYTRACEXT0001: Activating MicroProfile OpenTracing Subsystem
16:42:28,542 INFO  [org.wildfly.extension.microprofile.health.smallrye] (ServerService Thread Pool -- 61) WFLYHEALTH0001: Activating Eclipse MicroProfile Health Subsystem
16:42:28,542 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
16:42:28,543 INFO  [org.wildfly.extension.microprofile.metrics.smallrye] (ServerService Thread Pool -- 62) WFLYMETRICS0001: Activating Eclipse MicroProfile Metrics Subsystem
16:42:28,552 INFO  [io.smallrye.metrics] (MSC service thread 1-7) Converted [2] config entries and added [4] replacements
16:42:28,556 INFO  [io.smallrye.metrics] (MSC service thread 1-7) Converted [3] config entries and added [14] replacements
16:42:28,561 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 64) WFLYNAM0001: Activating Naming Subsystem
16:42:28,564 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 70) WFLYSEC0002: Activating Security Subsystem
16:42:28,561 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.
16:42:28,572 INFO  [org.jboss.as.security] (MSC service thread 1-7) WFLYSEC0001: Current PicketBox version=5.0.3.Final
16:42:28,620 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 43) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.4)
16:42:28,636 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 74) WFLYWS0002: Activating WebServices Extension
16:42:28,699 INFO  [org.jboss.as.connector] (MSC service thread 1-5) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.4.16.Final)
16:42:28,700 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) WFLYJCA0018: Started Driver service with driver-name = h2
16:42:28,829 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 58) WFLYJSF0007: Activated the following JSF Implementations: [main]
16:42:28,847 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-2) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
16:42:28,851 INFO  [org.jboss.as.naming] (MSC service thread 1-2) WFLYNAM0003: Starting Naming Service
16:42:29,014 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0003: Undertow 2.0.21.Final starting
16:42:29,256 INFO  [org.jboss.as.ejb3] (MSC service thread 1-7) 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.
16:42:29,256 INFO  [org.jboss.as.ejb3] (MSC service thread 1-7) 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.
16:42:29,404 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: '[]']
16:42:29,466 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0012: Started server default-server.
16:42:29,468 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0018: Host default-host starting
16:42:29,835 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0006: Undertow HTTP listener default listening on 0.0.0.0:8080
16:42:30,171 INFO  [org.jboss.as.jaxrs] (ServerService Thread Pool -- 53) WFLYRS0016: RESTEasy version 3.7.0.Final
16:42:30,451 INFO  [org.jboss.as.ejb3] (MSC service thread 1-7) WFLYEJB0493: EJB subsystem suspension complete
16:42:30,525 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
16:42:31,097 INFO  [org.jboss.as.patching] (MSC service thread 1-4) WFLYPAT0050: WildFly Full cumulative patch ID is: base, one-off patches include: none
16:42:31,122 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) WFLYDS0013: Started FileSystemDeploymentService for directory /opt/wildfly-17.0.1.Final/standalone/deployments
16:42:31,423 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0006: Undertow HTTPS listener https listening on 0.0.0.0:8443
16:42:31,709 INFO  [org.jboss.ws.common.management] (MSC service thread 1-1) JBWS022052: Starting JBossWS 5.3.0.Final (Apache CXF 3.3.2) 
16:42:31,822 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
16:42:31,825 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
16:42:31,825 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
16:42:31,825 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 17.0.1.Final (WildFly Core 9.0.2.Final) started in 10385ms - Started 314 of 576 services (369 services are lazy, passive or on-demand)

Checking the Wildfly Running Process

The above process will stop without having any redirection back to the command line interface. It is because Wildfly Java Application Server running in the foreground process. The attempt for typing ‘Ctrl+C’ to terminate and redirect the output back to the command line interface will stop the process. In the end, it will also stop the service. In this context, running the process as ‘wildfly’ user account is an effort to secure the process. Furthermore, adding parameter -b will define a specific address where the Wildfly will run to listen an incoming request. It is running in the broadcast address of ‘0.0.0.0’. In other words, it will listen in all of the available addresses exist in the machine.

For checking the status of the running Wildfly process of service, please refer to the article with the title of ‘How to Check Wildfly Java Application Server running service or process’ in this link.

Leave a Reply