A quick start to wildfly (JBoss AS) application server

What is wildfly

JBoss AS was named wildfly from version 8. Wildfly is an open source lightweight application server based on Java EE. It can be used for free in any commercial application.

Wildfly is a flexible, lightweight, powerful management application server. Wildfly is a container and server for managing EJB s, but JBoss core services do not include WEB containers that support servlets / JSPS, which are usually bound to Tomcat or Jetty.

Characteristic

  • Unparalleled speed: fast start, unlimited network performance and scalability.
  • Very lightweight: thin memory management, customizable runtime.
  • Powerful management function: unified configuration and management.

For more features of Wildfly and comparison with common Web services on the market, please refer to< Comparison of popular WEB containers TOMCAT, JETTY, GLASSFISH and WILDFLY>.

Download and install

Download address of wildfly: https://wildfly.org/downloads/

At present, the latest version is 18.0.0.Final. Select the ZIP version corresponding to "Java EE full & Web distribution" and click download. If the download is slow on the official website, you can follow the wechat public account "new vision of the program" and reply "wildfly" to get the download link.

java 8 or later is required to install the java environment.

The so-called installation is decompression. Let's look at the directory structure of this version:

├── LICENSE.txt
├── README.txt
├── appclient
├── bin
├── copyright.txt
├── docs
├── domain
├── jboss-modules.jar
├── modules
├── standalone
└── welcome-content

The application stored in the standalone directory will occupy the process independently, and can be started and closed independently, with no relationship between them. There are many xml files to choose from at startup.

The applications in the domain directory are related. managing multiple servers from a single control point.

modules directory, jboss uses module loading driver.

readme and start command

Focus on the contents of readme, which provides guidance on starting.

Key features:

Key Features
------------
* Jakarta EE 8 support
* Fast Startup
* Small Footprint
* Modular Design
* Unified Configuration and Management
* Distributed Domain Management

Obtain the document. At the same time, you can see that the default is to listen to port 8080 at startup.

Also, once WildFly is started you can go to http://localhost:8080/
for additional information.

Start command:

Starting a Standalone Server
----------------------------
A WildFly standalone server runs a single instance.

<JBOSS_HOME>/bin/standalone.sh      (Unix / Linux)

<JBOSS_HOME>\bin\standalone.bat     (Windows)

The startup script is located in the root / bin directory. Windows is standalone.bat and Linux is standalone.sh.

Wildfly can also start an administration background to manage services.

Starting a Managed Domain
-------------------------
A WildFly managed domain allows you to control and configure multiple instances,
potentially across several physical (or virtual) machines. The default 
configuration includes a domain controller and a single server group with three 
servers (two of which start automatically), all running on the localhost.

<JBOSS_HOME>/bin/domain.sh      (Unix / Linux)

<JBOSS_HOME>\bin\domain.bat     (Windows)

The startup script is located in the root / bin directory. Windows is domain.bat and Linux is domain.sh.

To stop the service, you can enter the Ctrl+c command through the console. If the service is running in the background, you can execute the following command to stop it.

<JBOSS_HOME>/bin/jboss-cli.sh --connect --command=:shutdown      (Unix / Linux)

<JBOSS_HOME>\bin\jboss-cli.bat --connect --command=:shutdown     (Windows)

Start operation

Now start the project standalone to see the effect.

19:48:11,234 INFO  [org.jboss.as.ejb3] (MSC service thread 1-6) 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.
19:48:11,234 INFO  [org.jboss.as.ejb3] (MSC service thread 1-2) 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.
19:48:11,296 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
19:48:11,409 INFO  [org.jboss.as.ejb3] (MSC service thread 1-6) WFLYEJB0493: EJB subsystem suspension complete
19:48:11,479 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
19:48:11,579 INFO  [org.jboss.as.patching] (MSC service thread 1-3) WFLYPAT0050: WildFly Full cumulative patch ID is: base, one-off patches include: none
19:48:11,596 WARN  [org.jboss.as.domain.management.security] (MSC service thread 1-5) WFLYDM0111: Keystore /Users/zzs/tools/wildfly18/standalone/configuration/application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
19:48:11,606 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-6) WFLYDS0013: Started FileSystemDeploymentService for directory /Users/zzs/tools/wildfly18/standalone/deployments
19:48:11,746 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443
19:48:11,846 INFO  [org.jboss.ws.common.management] (MSC service thread 1-2) JBWS022052: Starting JBossWS 5.3.0.Final (Apache CXF 3.3.3)
19:48:11,963 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
19:48:11,965 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
19:48:11,965 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
19:48:11,965 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 18.0.0.Final (WildFly Core 10.0.0.Final) started in 3880ms - Started 315 of 577 services (369 services are lazy, passive or on-demand)

As can be seen from the above logs, wildfly listens to ports 808443 and 9990.

The url of the access server is 127.0.0.1:8080, and the url of the access management background is: http://127.0.0.1:9990/.

Visit the server to see the following pages:

The page contains links such as documents, quick start, management background, etc.

At this time, when accessing background management, you will be prompted as follows:

Welcome to WildFly
Your WildFly Application Server is running.
However you have not yet added any users to be able to access the admin console.

To add a new user execute the add-user.sh script within the bin folder of your WildFly installation and enter the requested information.

By default the realm name used by WildFly is "ManagementRealm" this is already selected by default.

After you have added the user follow this link to Try Again.

That is to say, the startup was successful, but the user was not configured. Like tomcat, wildfly also has its own service management page, which can uniformly manage applications and set authorized users. Execute the add user script to add a manager user.

bin zzs$ ./add-user.sh

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
 # Enter a to add an administrative user
(a): a

Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
# enter one user name
Username : zzs
Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
 - The password should be different from the username
 - The password should not be one of the following restricted values {root, admin, administrator}
 - The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
 # Enter user password
Password :
# Reenter password
Re-enter Password :
# Leave blank or enter ManagementRealm
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]: ManagementRealm
About to add user 'zzs' for realm 'ManagementRealm'
# Continue with yes
Is this correct yes/no? yes
Added user 'zzs' to file '/Users/zzs/tools/wildfly18/standalone/configuration/mgmt-users.properties'
Added user 'zzs' to file '/Users/zzs/tools/wildfly18/domain/configuration/mgmt-users.properties'
Added user 'zzs' with groups ManagementRealm to file '/Users/zzs/tools/wildfly18/standalone/configuration/mgmt-groups.properties'
Added user 'zzs' with groups ManagementRealm to file '/Users/zzs/tools/wildfly18/domain/configuration/mgmt-groups.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
# Continue with yes
yes/no? yes

//Note here that after the user is added, the secret value will be returned to you. It can be used in the communication between domain and slave.
To represent the user add the following to the server-identities definition <secret value="MTk4NzEwMjlfUXE=" />

There will be corresponding prompts and options for each step of operation. Just fill in the prompts.

After setting, click Administration Console or visit http://127.0.0.1 : 9990 /, enter the user name and password just set to log in to the management background.

Original link:< A quick start to wildfly (JBoss AS) application server>

Reference article:< Comparison of popular WEB containers TOMCAT, JETTY, GLASSFISH and WILDFLY>


New vision of < center > program: you can't miss the highlights and growth < / center >

Keywords: Java Linux Windows Tomcat

Added by djKale on Fri, 18 Oct 2019 16:10:10 +0300