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月前
|
Java 关系型数据库 API
探索后端技术:构建高效、可靠的服务器端应用
在当今数字化时代,后端技术是任何成功应用程序的基石。它涉及服务器、数据库和应用程序之间的交互,处理数据存储、业务逻辑和系统性能等关键任务。本文将深入探讨后端开发的核心概念、常见技术栈及其实际应用,帮助读者更好地理解和掌握构建高效、可靠后端系统的技巧与策略。
|
6月前
|
监控 中间件 Java
后端技术:构建高效、稳定的服务器端应用
【10月更文挑战第5天】后端技术:构建高效、稳定的服务器端应用
228 0
|
1月前
|
Java 网络安全 Apache
SshClient应用指南:使用org.apache.sshd库在服务器中执行命令。
总结起来,Apache SSHD库是一个强大的工具,甚至可以用于创建你自己的SSH Server。当你需要在服务器中执行命令时,这无疑是非常有用的。希望这个指南能对你有所帮助,并祝你在使用Apache SSHD库中有一个愉快的旅程!
102 29
|
1月前
|
弹性计算 Linux 云计算
阿里云操作系统控制台——ECS操作及云计算应用实践
本文详细介绍了云服务器ECS的使用流程,包括开通服务、系统配置、权限管理、组件安装及内存全景诊断等关键步骤。通过开通阿里云操作系统服务、授予RAM用户权限和安装必要组件,可实现对服务器的有效管理与维护。在内存诊断部分,展示了如何发起诊断并解析结果,帮助精准定位内存问题。此外,文章还讲解了利用ECS训练模型的操作方法,从上传文件到终端命令执行,直至完成模型训练。最后总结指出,掌握这些技能不仅提升了对云服务器架构的理解,还为实际业务提供了高效解决方案,展现了ECS在数据处理与分析中的重要价值。
147 8
阿里云操作系统控制台——ECS操作及云计算应用实践
|
5月前
|
存储 缓存 前端开发
如何优化 SSR 应用以减少服务器压力
优化SSR应用以减少服务器压力,可采用代码分割、缓存策略、数据预加载、服务端性能优化、使用CDN、SSR与SSG结合、限制并发请求、SSR与CSR平滑切换、优化前端资源及利用框架特性等策略。这些方法能有效提升性能和稳定性,同时保证用户体验。
152 4
|
1月前
|
存储 弹性计算 安全
阿里云服务器ECS通用型规格族解析:实例规格、性能基准与场景化应用指南
作为ECS产品矩阵中的核心序列,通用型规格族以均衡的计算、内存、网络和存储性能著称,覆盖从基础应用到高性能计算的广泛场景。通用型规格族属于独享型云服务器,实例采用固定CPU调度模式,实例的每个CPU绑定到一个物理CPU超线程,实例间无CPU资源争抢,实例计算性能稳定且有严格的SLA保证,在性能上会更加稳定,高负载情况下也不会出现资源争夺现象。本文将深度解析阿里云ECS通用型规格族的技术架构、实例规格特性、最新价格政策及典型应用场景,为云计算选型提供参考。
|
6月前
|
机器学习/深度学习 人工智能 运维
企业内训|LLM大模型在服务器和IT网络运维中的应用-某日企IT运维部门
本课程是为某在华日资企业集团的IT运维部门专门定制开发的企业培训课程,本课程旨在深入探讨大型语言模型(LLM)在服务器及IT网络运维中的应用,结合当前技术趋势与行业需求,帮助学员掌握LLM如何为运维工作赋能。通过系统的理论讲解与实践操作,学员将了解LLM的基本知识、模型架构及其在实际运维场景中的应用,如日志分析、故障诊断、网络安全与性能优化等。
191 2
|
6月前
|
监控 关系型数据库 Serverless
探索后端技术:构建高效、可靠的服务器端应用
本文将深入探讨后端开发的核心概念和关键技术,从服务器架构到数据库管理,再到安全防护,为读者提供全面的后端技术指南。无论是初学者还是经验丰富的开发者,都能从中汲取灵感,提升自己的技术水平。
|
2月前
|
机器学习/深度学习 运维 资源调度
深度学习在资源利用率优化中的应用:让服务器更聪明
深度学习在资源利用率优化中的应用:让服务器更聪明
156 6
|
5月前
|
弹性计算 开发工具 git
2分钟在阿里云ECS控制台部署个人应用(图文示例)
作为一名程序员,我在部署托管于Github/Gitee的代码到阿里云ECS服务器时,经常遇到繁琐的手动配置问题。近期,阿里云ECS控制台推出了一键构建部署功能,简化了这一过程,支持Gitee和GitHub仓库,自动处理git、docker等安装配置,无需手动登录服务器执行命令,大大提升了部署效率。本文将详细介绍该功能的使用方法和适用场景。
2分钟在阿里云ECS控制台部署个人应用(图文示例)
下一篇
oss创建bucket