WildFlyを使ってみる、その1

GlasshFishはJava12では動作しないことがわかり、Tomcat9は動作することがわかった。今後もサーブレットコンテナを使い続ければ良いことなのではあるが、アプリサーバのWildFlyはどうなのだろうか?試してみることにする。

ダウンロードとインストール

https://wildfly.org/downloads/から「wildfly-17.0.1.Final.zip」をダウンロードして解凍。

実行

bin\standalone.batを起動する。

C:\Users\admin\Desktop\wildfly\bin>standalone
Calling "C:\Users\admin\Desktop\wildfly\bin\standalone.conf.bat"
JAVA_HOME is not set. Unexpected results may occur.
Set JAVA_HOME to the directory of your local JDK to avoid this message.
===============================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: "C:\Users\admin\Desktop\wildfly"

  JAVA: "java"

  JAVA_OPTS: "-Dprogram.name=standalone.bat -Xms64M -Xmx512M -XX:MetaspaceSize=9
6M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.sys
tem.pkgs=org.jboss.byteman  --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add
-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.
reflect=ALL-UNNAMED"

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

13:38:40,719 INFO  [org.jboss.modules] (main) JBoss Modules version 1.9.1.Final
13:38:41,863 INFO  [org.jboss.msc] (main) JBoss MSC version 1.4.8.Final
13:38:41,879 INFO  [org.jboss.threads] (main) JBoss Threads version 2.3.3.Final
13:38:42,115 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly
Full 17.0.1.Final (WildFly Core 9.0.2.Final) starting
13:38:44,003 INFO  [org.wildfly.security] (ServerService Thread Pool -- 28) ELY0
0001: WildFly Elytron version 1.9.1.Final
13:38:44,891 INFO  [org.jboss.as.controller.management-deprecated] (Controller B
oot 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.

13:38:44,956 INFO  [org.jboss.as.controller.management-deprecated] (ServerServic

(略)

13:38:47,518 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http man
agement interface listening on http://127.0.0.1:9990/management
13:38:47,519 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin co
nsole listening on http://127.0.0.1:9990
13:38:47,523 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly
Full 17.0.1.Final (WildFly Core 9.0.2.Final) started in 7465ms - Started 314 of
576 services (369 services are lazy, passive or on-demand)

※ちなみに停止するには、^Cすればいいそうだ。

localhost:8080にアクセスすると以下の画面が表示される。

ちゃんとJava12上で動作するようだ。リリースも頻繁に行われているようで、2017/9が最後の正式リリースのGlassFishとは大違いと言える。

管理コンソールにアクセス

先の画面の「Administration Console」をクリックすると、管理画面が出るはずなのだが、しかし「ユーザを一人も定義していない」と文句を言われる。bin\add-user.batを起動してユーザを追加しろという。

c:\Users\admin\Desktop\wildfly\bin>add-user
JAVA_HOME is not set. Unexpected results may occur.
Set JAVA_HOME to the directory of your local JDK to avoid this message.

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

Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : ysugimura
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, admi
n, administrator}
 - The password should contain at least 8 characters, 1 alphabetic character(s),
 1 digit(s), 1 non-alphanumeric symbol(s)
Password :
WFLYDM0101: Password should have at least 1 digit.
Are you sure you want to use the password entered yes/no? yes
Re-enter Password :
What groups do you want this user to belong to? (Please enter a comma separated
list, or leave blank for none)[  ]:
About to add user 'ysugimura' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'ysugimura' to file 'C:\Users\admin\Desktop\wildfly\standalone\config
uration\mgmt-users.properties'
Added user 'ysugimura' to file 'C:\Users\admin\Desktop\wildfly\domain\configurat
ion\mgmt-users.properties'
Added user 'ysugimura' with groups  to file 'C:\Users\admin\Desktop\wildfly\stan
dalone\configuration\mgmt-groups.properties'
Added user 'ysugimura' with groups  to file 'C:\Users\admin\Desktop\wildfly\doma
in\configuration\mgmt-groups.properties'
Is this new user going to be used for one AS process to connect to another AS pr
ocess?
e.g. for a slave host controller connecting to the master or for a Remoting conn
ection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition <sec
ret value="aGFtdXRhcm8=" />
続行するには何かキーを押してください . . .

この後で、ブラウザの方のTry Againをクリックすると、アカウント入力になる。ログインすると、以下の画面になる。

ともあれ、Java12上で十分まともに動作しているようだ。

参考