Débuter avec la mouche sauvage

Installation

L’installation de Wildfly consiste simplement à décompresser la distribution sur votre machine locale. Wildfly peut être téléchargé depuis son [site officiel][1].

Une fois décompressé, accédez au répertoire bin d’installation et exécutez standalone.sh pour les systèmes Linux ou standalone.bat pour les systèmes Windows pour démarrer votre instance WildFly dans les configurations par défaut. Une fois que vous voyez quelque chose comme

13:16:12,503 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) started in 18909ms - Started 331 of 577 services (393 services are lazy, passive or on-demand)

puis votre toute nouvelle instance WildFly vous attend sur : http://localhost:8080/

Certaines distributions Linux, telles que Fedora, ont Wildfly sur ses dépôts et peuvent être installées via YUM/DNF : dnf install wildfly. Ceci, cependant, n’est pas vraiment recommandé, car il a tendance à utiliser des versions légèrement différentes des bibliothèques que la distribution officielle, ce qui pourrait causer des problèmes difficiles à diagnostiquer/réparer.

[1] : http://wildfly.org

Exécution via Docker

Wildfly, qui fait partie de l’ensemble de projets JBoss, peut également être exécuté via Docker. Sur une machine avec Docker correctement configuré, exécutez :

$ docker run -it jboss/wildfly

Une fois l’image extraite, le conteneur démarre et la ligne suivante s’affiche :

09:44:49,225 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) started in 5644ms - Started 267 of 553 services (371 services are lazy, passive or on-demand)

Il s’agit d’un serveur Wildfly “vide”. Sur les projets du monde réel, l’image de base est destinée à être étendue afin que votre application au format d’empaquetage WAR/EAR y soit ajoutée, ainsi que les modifications de configuration nécessaires à standalone/configuration/standalone.xml.

Démarrage du serveur

Une fois Wildfly installé en décompressant la distribution, il peut être démarré en exécutant le script standalone.sh sur le répertoire bin :

$ ./bin/standalone.sh 
=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /mnt/storage/tools/servers/wildfly-10.0.0.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

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

11:54:33,781 INFO  [org.jboss.modules] (main) JBoss Modules version 1.5.1.Final
11:54:34,096 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
11:54:34,193 INFO  [org.jboss.as] (MSC service thread 1-6) WFLYSRV0049: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) starting
...
...
11:54:37,653 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) started in 4357ms - Started 273 of 559 services (374 services are lazy, passive or on-demand)

Sans arguments, la configuration par défaut est utilisée. Pour remplacer la configuration par défaut, vous pouvez fournir des arguments sur la ligne de commande.

--admin-only                        Set the server's running type to
                                    ADMIN_ONLY causing it to open
                                    administrative interfaces and accept
                                    management requests but not start other
                                    runtime services or accept end user
                                    requests.


-b <value>, -b=<value>              Set system property jboss.bind.address
                                    to the given value


-b<interface>=<value>               Set system property
                                    jboss.bind.address.<interface> to the
                                    given value


-c <config>, -c=<config>            Name of the server configuration file
                                    to use (default is "standalone.xml")
                                    (Same as --server-config)


--debug [<port>]                    Activate debug mode with an optional
                                    argument to specify the port. Only
                                    works if the launch script supports it.


-D<name>[=<value>]                  Set a system property


-h, --help                          Display this message and exit


--read-only-server-config=<config>  Name of the server configuration file
                                    to use. This differs from
                                    '--server-config' and '-c' in that the
                                    original file is never overwritten.


-P <url>, -P=<url>,                 Load system properties from the given
     --properties=<url>             url


-S<name>[=<value>]                  Set a security property


--server-config=<config>            Name of the server configuration file
                                    to use (default is "standalone.xml")
                                    (Same as -c)


-u <value>, -u=<value>              Set system property
                                    jboss.default.multicast.address to the
                                    given value


-v, -V, --version                   Print version and exit


-secmgr                             Runs the server with a security manager
                                    installed.