How to Start Wildfly Java Application Server using Wildfly User Account as a Foreground Process

Posted on

Starting Wildfly Java Application Server using Wildfly Account as a Foreground Process

This is an another article containing a description about how to start Wildfly Java Application Server. There are also several other articles with the same content. Those articles are in this link and also in this link. But in this article, there is a slight different with those previous articles. It is on the user account whom is executing the process. In this article, there is a specific user account performing to start the process. Below is the steps for starting Wildfly Java Application Server using another account :

1. Switch to ‘root’ user account. The following is the process for switching to root account :

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

2. After switching to ‘root’ user account, just execute the following pattern command to run the Wildfly Java Application Server’s service :

runuser user_name -l wildfy_script_path

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

root@hostname ~# runuser wildfly -l /opt/wildfly-17.0.1.Final/bin/standalone.sh 
=========================================================================
  JBoss Bootstrap Environment
  JBOSS_HOME: /opt/wildfly-17.0.1.Final
here
  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 
=========================================================================
08:55:24,271 INFO  [org.jboss.modules] (main) JBoss Modules version 1.9.1.Final
08:55:24,506 INFO  [org.jboss.msc] (main) JBoss MSC version 1.4.8.Final
08:55:24,513 INFO  [org.jboss.threads] (main) JBoss Threads version 2.3.3.Final
08:55:24,600 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 17.0.1.Final (WildFly Core 9.0.2.Final) starting
08:55:25,148 INFO  [org.wildfly.security] (ServerService Thread Pool -- 4) ELY00001: WildFly Elytron version 1.9.1.Final
08:55:25,534 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.
08:55:25,571 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.
08:55:25,628 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
08:55:25,642 INFO  [org.xnio] (MSC service thread 1-7) XNIO version 3.7.2.Final
08:55:25,653 INFO  [org.xnio.nio] (MSC service thread 1-7) XNIO NIO Implementation Version 3.7.2.Final
08:55:25,696 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 43) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.4)
08:55:25,711 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 51) WFLYCLINF0001: Activating Infinispan subsystem.
08:55:25,721 INFO  [org.jboss.as.connector] (MSC service thread 1-8) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.4.16.Final)
08:55:25,722 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
08:55:25,732 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) WFLYJCA0018: Started Driver service with driver-name = h2
08:55:25,840 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 58) WFLYJSF0007: Activated the following JSF Implementations: [main]
08:55:25,850 INFO  [org.jboss.as.jaxrs] (ServerService Thread Pool -- 53) WFLYRS0016: RESTEasy version 3.7.0.Final
08:55:25,851 INFO  [org.wildfly.extension.microprofile.config.smallrye._private] (ServerService Thread Pool -- 60) WFLYCONF0001: Activating WildFly MicroProfile Config Subsystem
08:55:25,857 INFO  [org.wildfly.extension.microprofile.health.smallrye] (ServerService Thread Pool -- 61) WFLYHEALTH0001: Activating Eclipse MicroProfile Health Subsystem
08:55:25,878 INFO  [org.wildfly.extension.microprofile.metrics.smallrye] (ServerService Thread Pool -- 62) WFLYMETRICS0001: Activating Eclipse MicroProfile Metrics Subsystem
08:55:25,878 INFO  [org.wildfly.extension.microprofile.opentracing] (ServerService Thread Pool -- 63) WFLYTRACEXT0001: Activating MicroProfile OpenTracing Subsystem
08:55:25,908 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 70) WFLYSEC0002: Activating Security Subsystem
08:55:25,912 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 64) WFLYNAM0001: Activating Naming Subsystem
08:55:25,917 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.
08:55:25,928 INFO  [org.jboss.as.naming] (MSC service thread 1-4) WFLYNAM0003: Starting Naming Service
08:55:25,934 INFO  [io.smallrye.metrics] (MSC service thread 1-5) Converted [2] config entries and added [4] replacements
08:55:25,938 INFO  [io.smallrye.metrics] (MSC service thread 1-5) Converted [3] config entries and added [14] replacements
08:55:25,951 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-8) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
08:55:25,957 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 74) WFLYWS0002: Activating WebServices Extension
08:55:25,955 INFO  [org.jboss.as.security] (MSC service thread 1-5) WFLYSEC0001: Current PicketBox version=5.0.3.Final
08:55:25,958 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0003: Undertow 2.0.21.Final starting
08:55:25,966 INFO  [org.jboss.remoting] (MSC service thread 1-3) JBoss Remoting version 5.0.12.Final
08:55:26,048 INFO  [org.jboss.as.ejb3] (MSC service thread 1-1) 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.
08:55:26,054 INFO  [org.jboss.as.ejb3] (MSC service thread 1-5) 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.
08:55:26,089 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: '[]']
08:55:26,091 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0012: Started server default-server.
08:55:26,092 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0018: Host default-host starting
08:55:26,176 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
08:55:26,246 INFO  [org.jboss.as.ejb3] (MSC service thread 1-5) WFLYEJB0493: EJB subsystem suspension complete
08:55:26,295 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
08:55:26,386 INFO  [org.jboss.as.patching] (MSC service thread 1-1) WFLYPAT0050: WildFly Full cumulative patch ID is: base, one-off patches include: none
08:55:26,402 WARN  [org.jboss.as.domain.management.security] (MSC service thread 1-2) WFLYDM0111: Keystore /opt/wildfly-17.0.1.Final/standalone/configuration/application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
08:55:26,406 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) WFLYDS0013: Started FileSystemDeploymentService for directory /opt/wildfly-17.0.1.Final/standalone/deployments
08:55:26,453 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443
08:55:26,525 INFO  [org.jboss.ws.common.management] (MSC service thread 1-1) JBWS022052: Starting JBossWS 5.3.0.Final (Apache CXF 3.3.2) 
08:55:26,646 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
08:55:26,648 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
08:55:26,648 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
08:55:26,648 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 17.0.1.Final (WildFly Core 9.0.2.Final) started in 2633ms - Started 314 of 576 services (369 services are lazy, passive or on-demand)

According to the above output, Wildfly Java Application Server has successfully started. The information exist as part of the output in the last line as follows :

WildFly Full 17.0.1.Final (WildFly Core 9.0.2.Final) started

Currently, it is running in the foreground process. In other words, if the command line is stop or suddenly terminated, the process will also stop.

 

 

Checking Wildfly Java Application Server’s status

Last but not least, don’t forget to check whether Wildfly Java Application Server is actually running or not. There are several ways for checking the status of the service. Execute the following command in another command line interface :

netstat -tulpn | grep port_number

The following is the example of the above command pattern execution :

root@hostname ~# netstat -tulpn | grep 8080
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      30065/java 
root@hostname ~#

The above output command is for checking the status of the Wildfly Java Application Server’s service.

         
root@hostname ~# netstat -tulpn | grep 9990
tcp        0      0 127.0.0.1:9990          0.0.0.0:*               LISTEN      30065/java          
root@hostname ~#

In the above output command is for checking the status of the Wildfly Java Application Server’s administration console service.

root@hostname ~# netstat -tulpn | grep 8443
tcp        0      0 127.0.0.1:8443          0.0.0.0:*               LISTEN      30065/java
root@hostname ~#

The last one is for the secure port of the Wildfly Java Applicationi Server’s service.

ps aux | grep wildfly

All of the above three ports running and listening for incoming request is indicating the status of the Wildfly Java Application Server’s service. It is running with the same process ID which is the process ID of Wildfly Java Application Server. In order to prove it, execute the following command :

          
root@hostname ~# ps aux | grep wildfly
root     30016  0.0  0.0  70632  3896 pts/4    S+   11:43   0:00 runuser wildfly -l /opt/wildfly-17.0.1.Final/bin/standalone.sh
wildfly  30018  0.0  0.0  18504  3188 pts/4    S+   11:43   0:00 -bash /opt/wildfly-17.0.1.Final/bin/standalone.sh
wildfly  30065 19.0  1.9 2233544 314072 pts/4  Sl+  11:43   0:14 java -D[Standalone] -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Dorg.jboss.boot.log.file=/opt/wildfly-17.0.1.Final/standalone/log/server.log -Dlogging.configuration=file:/opt/wildfly-17.0.1.Final/standalone/configuration/logging.properties -jar /opt/wildfly-17.0.1.Final/jboss-modules.jar -mp /opt/wildfly-17.0.1.Final/modules org.jboss.as.standalone -Djboss.home.dir=/opt/wildfly-17.0.1.Final -Djboss.server.base.dir=/opt/wildfly-17.0.1.Final/standalone
root     30268  0.0  0.0  23960  1040 pts/5    S+   11:44   0:00 grep wildfly
root@hostname ~#

As in the above output, the process ID of Wildfly Java Application Server is ‘30065’. It is a proof enough to support the previous command output that Wildfly Java Application Server is running.

Leave a Reply