wildfly(JBoss AS)应用服务器快速入门

简介: wildfly(JBoss AS)应用服务器快速入门

什么是wildfly

JBoss AS 从8版本起名为wildfly。Wildfly是一个开源的基于JavaEE的轻量级应用服务器。可以在任何商业应用中免费使用。


WildFly是一个灵活的、轻量的、强大管理能力的应用程序服务器。Wildfly是一个管理EJB的容器和服务器,但JBoss核心服务不包括支持servlet/JSP的WEB容器,一般与Tomcat或Jetty绑定使用。


特点

无与伦比的速度:快速启动,无限的网络性能和可扩展性。

非常的轻量级:瘦内存管理,运行时间可定制化。

强大的管理功能:统一的配置和管理。

Wildfly更多特点及与市面上常见的Web服务对比,可参看《热门WEB容器TOMCAT、JETTY、 GLASSFISH、WILDFLY对比》。


下载安装

wildfly下载地址:https://wildfly.org/downloads/


目前,最新版本是18.0.0.Final,选择“Java EE Full & Web Distribution”项对应的ZIP版本,点击下载即可。如果官网下载较慢,可关注微信公众号“程序新视界”,回复“wildfly”获得下载链接。


安装java环境要求Java8或更高版本。


所谓的安装即解压即可。下面看一下该版本的目录结构:


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

standalone目录下存放的应用将单独占用进程,可单独启动和关闭,之间没有关联性。旗下有许多xml文件可供启动时选择。


domain目录下的应用之间有关联性,managing multiple servers from a single control point。


modules目录,jboss采用module加载驱动。


readme及启动命令

重点看一下readme中的内容,提供了启动相关的指导。


关键特性:


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

文档获取,同时也可以看出启动时默认是监听8080端口。

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

启动命令:

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)

启动脚本位于根目录/bin目录中。Windows为standalone.bat,Linux为standalone.sh。

Wildfly还可以启动一个管理后台来对服务进行管理。

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)

启动脚本位于根目录/bin目录中。Windows为domain.bat,Linux为domain.sh。


停止服务,可以通过控制台输入Ctrl c命令来操作。如果服务在后台运行,可执行一下命令进行停止。


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


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


启动操作

现在启动项目standalone看一下效果。


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)

通过以上部分日志可以看到,wildfly监听了8080,8443和9990端口。

访问服务器的url为:127.0.0.1:8080,访问管理后台的url为:http://127.0.0.1:9990/

访问服务器可看到如下页面:image.png页面内包含文档、快速启动、管理后台等链接。

此时访问后台管理会提示如下内容:

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.

也就是说启动成功了,但没有配置用户。同tomcat一样,wildfly也有自己的服务管理页面,可以统一管理应用,设置权限用户。执行add-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)
 # 输入a,以添加管理用户
(a): a
Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
# 输入用户名
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)
 # 输入用户密码
Password :
# 重新输入密码
Re-enter Password :
# 留空即可或输入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'
# 继续则输入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.
# 继续则输入yes
yes/no? yes
这里需要注意,用户添加完毕后,将回馈给你此用户的secret value,可在domain与slave 的通信中用到
To represent the user add the following to the server-identities definition <secret value="MTk4NzEwMjlfUXE=" />

每一步操作都会有对应的提示与选项,按照提示填写即可。

设置完成,再进点击Administration Console或访问http://127.0.0.1:9990/,输入刚刚设置的用户名密码,即可登录管理后台。image.png

目录
相关文章
|
6月前
|
机器学习/深度学习 数据库 数据安全/隐私保护
服务器核心组件:CPU 与 GPU 的核心区别、应用场景、协同工作
CPU与GPU在服务器中各司其职:CPU擅长处理复杂逻辑,如订单判断、网页请求;GPU专注批量并行计算,如图像处理、深度学习。二者协同工作,能大幅提升服务器效率,满足多样化计算需求。
2612 39
|
5月前
|
存储 机器学习/深度学习 人工智能
硅谷GPU单节点服务器:技术解析与应用全景
“硅谷GPU单节点服务器”代表了在单个物理机箱内集成强大计算能力,特别是GPU加速能力的高性能计算解决方案。它们并非指代某个特定品牌,而是一类为处理密集型工作负载而设计的服务器范式的统称。
|
8月前
|
弹性计算 关系型数据库 数据库
阿里云服务器ECS是什么?ECS应用场景、租用流程及使用教程整理
阿里云ECS(弹性计算服务)是性能稳定、弹性扩展的云计算服务,支持多种处理器架构和实例类型,适用于网站托管、开发测试、数据存储、企业服务、游戏多媒体及微服务架构等场景。提供从注册、配置到部署、运维的完整使用流程,助力用户高效上云。
|
10月前
|
开发框架 人工智能 Java
破茧成蝶:阿里云应用服务器让传统 J2EE 应用无缝升级 AI 原生时代
本文详细介绍了阿里云应用服务器如何助力传统J2EE应用实现智能化升级。文章分为三部分:第一部分阐述了传统J2EE应用在智能化转型中的痛点,如协议鸿沟、资源冲突和观测失明;第二部分展示了阿里云应用服务器的解决方案,包括兼容传统EJB容器与微服务架构、支持大模型即插即用及全景可观测性;第三部分则通过具体步骤说明如何基于EDAS开启J2EE应用的智能化进程,确保十年代码无需重写,轻松实现智能化跃迁。
752 42
|
9月前
|
存储 分布式计算 安全
阿里云服务器ECS实例选型参考:场景适配、应用推荐
选择阿里云服务器ECS实例之前,需要结合性能、价格、工作负载等因素,做出性价比与稳定性最优的决策。对于很多新手用户来说,在初次购买阿里云服务器的时候,面对众多实例规格往往不知道如何选择,因为云服务器实例规格不同,价格也不一样,性能表现更是千差万别。因此,在购买阿里云服务器ECS实例之前,需要结合性能、价格、工作负载等因素,做出性价比与稳定性最优的决策。本文将通过一些常见的选型场景推荐,为大家详细介绍阿里云服务器实例选型的最佳实践,便于大家在选择云服务器实例规格时做个参考。
|
5月前
|
机器学习/深度学习 人工智能 弹性计算
2025年阿里云GPU服务器租用价格与应用场景详解
阿里云GPU服务器基于ECS架构,集成NVIDIA A10/V100等顶级GPU与自研神龙架构,提供高达1000 TFLOPS混合精度算力。2025年推出万卡级异构算力平台及Aegaeon池化技术,支持AI训练、推理、科学计算与图形渲染,实现性能与成本最优平衡。
|
7月前
|
域名解析 运维 监控
阿里云轻量服务器的系统镜像和应用镜像的区别
轻量应用服务器是阿里云推出的易用型云服务器,支持一键部署、域名解析、安全管理和运维监控。本文介绍其系统镜像与应用镜像的区别及选择建议,助您根据业务需求和技术能力快速决策,实现高效部署。
|
7月前
|
存储 弹性计算 运维
阿里云服务器全解析:ECS是什么、应用场景、租用流程及优缺点分析
阿里云ECS(Elastic Compute Service)是阿里云提供的高性能、高可用的云计算服务,支持弹性扩展、多样化实例类型和多种计费模式。适用于网站搭建、数据处理、运维测试等多种场景,具备分钟级交付、安全可靠、成本低、易运维等优势,是企业及开发者上云的理想选择。
973 5
|
7月前
|
运维 监控 Kubernetes
Bitnami 替代品:Websoft9 如何接力单服务器多应用时代
Bitnami 曾为开源应用部署带来革命性体验,但随着 Docker 成熟与战略转向云原生,其单机多应用支持逐渐弱化。面对多应用管理分散、资源冲突、运维工具缺失等痛点,Websoft9 应运而生,提供一键部署、统一管理、智能调度等能力,全面优化单服务器多应用运维体验,成为 Bitnami 的理想继任者。
274 0
Bitnami 替代品:Websoft9 如何接力单服务器多应用时代