How to Run Wildfly Java Application Server via Command Line

Posted on

This article specifically contains the material for explaining about how to run Wildfly Java Application Server via command line using the appropriate command. Wildfly is a Java Application Server which in the official website of Wildfly is claimed as : “WildFly is a flexible, lightweight, managed application runtime that helps you build amazing applications” in this link. Below is the steps taken in order to run the Wildfly Java Application Server which is done in sequence :

1. Off course, a ready and installed Wildfly Java Application Server. See, this article titled ‘Installing Wildfly Java Application Server’ in this link.

2. Accessing the command prompt.

3. Running the command in the command prompt for running the service. Normally there are several command can be taken to run the service. Below are those commands :

./standalone.sh &

The ampersand sign on the end of the command executed where it is a trailing ampersand will direct the shell to run the command specified before the ampersand sign to run in the background. It is forked and run in a separate sub-shell, as a job, asynchronously. By forking and running the command on the separate sub-shell, the shell where the command is being executed will immediately return the return status of 0 for true and continue as normal, either processing further commands in a script or returning the cursor focus back to the user in a Linux terminal. It becomes an active terminal.

or

sh /opt/wildfly-12.0.0.Final/bin/standalone.sh &

sh is the default Bourne-compatible shell (usually bash or dash) where it acts as a command interpreter and it stands for shell.  Just beware that the file named standalone.sh must be owned by the user which is executing the file itself. Or to put it simple, the user must have the privilege to execute the file. Below is the command ‘jobs’ which is presenting the running command on the background :

user@hostname:/opt/wildfly-12.0.0.Final/bin$ jobs
[1]+ Running ./standalone.sh &
user@hostname:/opt/wildfly-12.0.0.Final/bin$

So, the above command execution is shown as follows :

user@hostname:/opt/wildfly-12.0.0.Final/standalone/configuration$ sh /opt/wildfly-12.0.0.Final/bin/standalone.sh &
[1] 14859
user@hostname:/opt/wildfly-12.0.0.Final/standalone/configuration$ =========================================================================

JBoss Bootstrap Environment

JBOSS_HOME: /opt/wildfly-12.0.0.Final

JAVA: /opt/jdk1.8.0_172/bin/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:04:36,750 INFO [org.jboss.modules] (main) JBoss Modules version 1.7.0.Final
14:04:37,203 INFO [org.jboss.msc] (main) JBoss MSC version 1.3.2.Final
14:04:37,215 INFO [org.jboss.threads] (main) JBoss Threads version 2.3.1.Final
14:04:37,352 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 12.0.0.Final (WildFly Core 4.0.0.Final) starting
14:04:39,100 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:04:39,182 INFO [org.wildfly.security] (ServerService Thread Pool -- 2) ELY00001: WildFly Elytron version 1.2.2.Final
14:04:39,250 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 29) 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:04:39,263 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0015: Re-attempting failed deployment webapp-1.0-SNAPSHOT.war
14:04:39,272 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found webapp-1.0-SNAPSHOT.war in deployment directory. To trigger deployment create a file called webapp-1.0-SNAPSHOT.war.dodeploy
14:04:39,275 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found webapp.war in deployment directory. To trigger deployment create a file called webapp.war.dodeploy
14:04:39,349 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
14:04:39,386 INFO [org.xnio] (MSC service thread 1-1) XNIO version 3.6.2.Final
14:04:39,396 INFO [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.6.2.Final
14:04:39,526 INFO [org.jboss.as.jaxrs] (ServerService Thread Pool -- 43) WFLYRS0016: RESTEasy version 3.5.0.Final
14:04:39,527 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 42) WFLYCLINF0001: Activating Infinispan subsystem.
14:04:39,533 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 36) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.4)
14:04:39,581 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 41) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
14:04:39,625 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 48) WFLYJSF0007: Activated the following JSF Implementations: [main]
14:04:39,622 INFO [org.jboss.remoting] (MSC service thread 1-3) JBoss Remoting version 5.0.5.Final
14:04:39,702 INFO [org.jboss.as.connector] (MSC service thread 1-1) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.4.7.Final)
14:04:39,716 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 50) WFLYNAM0001: Activating Naming Subsystem
14:04:39,732 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 36) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.cj.jdbc.Driver (version 8.0)
14:04:39,755 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) WFLYJCA0018: Started Driver service with driver-name = h2
14:04:39,757 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) WFLYJCA0018: Started Driver service with driver-name = mysql
14:04:39,737 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 58) 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:04:39,815 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 60) WFLYWS0002: Activating WebServices Extension
14:04:39,852 INFO [org.jboss.as.security] (ServerService Thread Pool -- 57) WFLYSEC0002: Activating Security Subsystem
14:04:39,934 INFO [org.jboss.as.mail.extension] (MSC service thread 1-1) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
14:04:39,954 INFO [org.jboss.as.naming] (MSC service thread 1-3) WFLYNAM0003: Starting Naming Service
14:04:39,957 INFO [org.jboss.as.security] (MSC service thread 1-1) WFLYSEC0001: Current PicketBox version=5.0.2.Final
14:04:40,017 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0003: Undertow 2.0.0.Final starting
14:04:40,647 INFO [org.jboss.as.ejb3] (MSC service thread 1-7) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 16 (per class), which is derived from the number of CPUs on this host.
14:04:40,648 INFO [org.jboss.as.ejb3] (MSC service thread 1-6) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 64 (per class), which is derived from thread worker pool sizing.
14:04:40,916 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 59) WFLYUT0014: Creating file handler for path '/opt/wildfly-12.0.0.Final/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
14:04:40,919 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0012: Started server default-server.
14:04:40,931 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0018: Host default-host starting
14:04:41,186 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
14:04:41,290 INFO [org.jboss.as.ejb3] (MSC service thread 1-7) WFLYEJB0493: EJB subsystem suspension complete
14:04:41,655 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
14:04:41,690 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) WFLYJCA0001: Bound data source [java:/jdbc/testing-database]
14:04:41,868 INFO [org.jboss.as.patching] (MSC service thread 1-3) WFLYPAT0050: WildFly Full cumulative patch ID is: base, one-off patches include: none
14:04:41,934 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-5) WFLYDS0013: Started FileSystemDeploymentService for directory /opt/wildfly-12.0.0.Final/standalone/deployments
14:04:41,924 WARN [org.jboss.as.domain.management.security] (MSC service thread 1-7) WFLYDM0111: Keystore /opt/wildfly-12.0.0.Final/standalone/configuration/application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
14:04:41,957 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Starting deployment of "webapp.war" (runtime-name: "webapp.war")
14:04:41,967 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0027: Starting deployment of "webapp-1.0-SNAPSHOT.war" (runtime-name: "webapp-1.0-SNAPSHOT.war")
14:04:42,731 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443
14:04:43,283 INFO [org.jboss.ws.common.management] (MSC service thread 1-5) JBWS022052: Starting JBossWS 5.2.0.Final (Apache CXF 3.2.2)
14:04:46,081 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.cj.jdbc.Driver (version 8.0)
14:04:46,452 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0018: Started Driver service with driver-name = webapp.war_com.mysql.cj.jdbc.Driver_8_0
14:04:47,622 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-3) ISPN000128: Infinispan version: Infinispan 'Bastille' 9.1.6.Final
14:04:48,058 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 62) WFLYCLINF0002: Started client-mappings cache from ejb container
14:04:48,515 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 68) WFLYUT0021: Registered web context: '/webapp' for server 'default-server'
14:04:48,812 INFO [org.jboss.as.server] (ServerService Thread Pool -- 37) WFLYSRV0010: Deployed "webapp.war" (runtime-name : "webapp.war")
14:04:48,929 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
14:04:48,929 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990

4. Check the running process by executing the following command :

ps -ef | grep wildfly

as shown in the following output command generated :

user@hostname:/opt/wildfly-12.0.0.Final/bin$ ps -ef | grep wildfly
user    15507 15465 12 14:10 pts/7    00:00:26 /opt/jdk1.8.0_172/bin/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-12.0.0.Final/standalone/log/server.log -Dlogging.configuration=file:/opt/wildfly-12.0.0.Final/standalone/configuration/logging.properties -jar /opt/wildfly-12.0.0.Final/jboss-modules.jar -mp /opt/wildfly-12.0.0.Final/modules org.jboss.as.standalone -Djboss.home.dir=/opt/wildfly-12.0.0.Final -Djboss.server.base.dir=/opt/wildfly-12.0.0.Final/standalone
user    15940 31643  0 14:13 pts/7    00:00:00 grep --color=auto wildfly
user@hostname:/opt/wildfly-12.0.0.Final/bin$

or

ps -aux | grep wildfly

which can be shown in the following output command generated :

user@hostname:/opt/wildfly-12.0.0.Final/bin$ ps -aux | grep wildfly
user 15507 11.1 5.3 2225076 433140 pts/7 Sl 14:10 0:26 /opt/jdk1.8.0_172/bin/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-12.0.0.Final/standalone/log/server.log -Dlogging.configuration=file:/opt/wildfly-12.0.0.Final/standalone/configuration/logging.properties -jar /opt/wildfly-12.0.0.Final/jboss-modules.jar -mp /opt/wildfly-12.0.0.Final/modules org.jboss.as.standalone -Djboss.home.dir=/opt/wildfly-12.0.0.Final -Djboss.server.base.dir=/opt/wildfly-12.0.0.Final/standalone
user 15946 0.0 0.0 17924 944 pts/7 S+ 14:14 0:00 grep --color=auto wildfly
user@hostname:/opt/wildfly-12.0.0.Final/bin$

5. Check also the port in normally 8080 an 9990 whether it is currently listening for incoming request :

netstat -tulpn | grep 8080

as shown in the following output command generated :

user@hostname:/opt/wildfly-12.0.0.Final/bin$ netstat -tulpn | grep 8080
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      15507/java 
user@hostname:/opt/wildfly-12.0.0.Final/bin$

or

netstat -tulpn | grep 9990

as shown in the following output command generated :

user@hostname:/opt/wildfly-12.0.0.Final/bin$ netstat -tulpn | grep 9990
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 127.0.0.1:9990 0.0.0.0:* LISTEN 15507/java
user@hostname:/opt/wildfly-12.0.0.Final/bin$

6. Check via browser as shown below :

How to Run Wildfly Java Application Server via Command Line
How to Run Wildfly Java Application Server via Command Line

Or, the management console page as shown below :

How to Run Wildfly Java Application Server via Command Line
How to Run Wildfly Java Application Server via Command Line

One thought on “How to Run Wildfly Java Application Server via Command Line

Leave a Reply