Wildfly 23启动后因超时阻塞问题求助
WildFly 23启动超时阻塞问题
问题现象
- WildFly 23启动后出现阻塞,触发启动超时
- 启动日志显示服务已完成启动:
17:44:17,093 INFO [org.jboss.as.mail.extension] (MSC service thread 1-8) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default] 17:44:17,201 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8180 17:44:17,202 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8543 17:44:17,456 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-3) WFLYDS0013: Started FileSystemDeploymentService for directory C:\Users\ActionICT-Motti\IdeaProjects\DocumentsStorage_v1\target\server\standalone\deployments 17:44:17,522 INFO [org.jboss.as.ejb3] (MSC service thread 1-7) WFLYEJB0493: Jakarta Enterprise Beans subsystem suspension complete 17:44:17,779 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS] 17:44:17,808 INFO [org.jboss.ws.common.management] (MSC service thread 1-4) JBWS022052: Starting JBossWS 7.0.0.Final (Apache CXF 4.0.0) 17:44:17,961 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server 17:44:17,968 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:10090/management 17:44:17,968 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:10090 17:44:17,971 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 30.0.0.Final (WildFly Core 22.0.1.Final) started in 8592ms - Started 280 of 522 services (317 services are lazy, passive or on-demand) - Server configuration file in use: standalone.xml
- 超时结束后出现异常:

使用的Maven插件配置
使用wildfly-maven-plugin管理WildFly,配置如下:
<plugin> <groupId>org.wildfly.plugins</groupId> <artifactId>wildfly-maven-plugin</artifactId> <version>4.0.0.Final</version> <configuration> <!-- 生产环境使用JBoss EAP 6.3 => JBoss AS 7.4.0.Final 但该版本在Maven仓库中不可用,因此使用最接近的版本 --> <version>23.0.0.Final</version> <javaOpts> -Xms64m <!-- -Xmx512m--> <!-- -XX:MaxMetaspaceSize=256m--> -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.socket.binding.port-offset=100 -Djboss.server.config.dir=${project.build.testOutputDirectory}/configuration <!-- ${jacocoAgent}--> <!-- <!--如需启用远程调试,请取消以下行注释--> <!-- -Xrunjdwp:transport=dt_socket,address=33333,server=y,suspend=y--> </javaOpts> <port>10090</port> </configuration> </plugin>
问题原因分析
- 插件与服务器版本不兼容:你使用的
wildfly-maven-plugin是4.0.0.Final,而WildFly服务器版本为23.0.0.Final。官方文档显示,插件4.x系列适配WildFly 26及以上版本,低版本WildFly(如23)需要搭配3.x系列插件,版本不匹配会导致插件无法正确识别服务器启动完成状态,误触发超时。 - 默认超时阈值不足:插件默认启动超时时间可能偏短,尽管日志显示服务器仅用8秒启动,但插件可能因通信延迟、状态检测逻辑问题,未能及时接收到启动完成信号,从而判定超时。
- 内存配置不合理:当前仅设置了初始堆内存
-Xms64m,未配置最大堆内存-Xmx和元空间大小,可能导致服务器启动过程中内存资源不足,出现隐性阻塞,插件无法及时检测到启动状态。
解决方案建议
- 匹配插件与服务器版本:将
wildfly-maven-plugin版本降级为3.0.2.Final(适配WildFly 23的稳定版本) - 延长超时时间:在插件配置的
<configuration>节点中添加<timeout>120</timeout>(单位:秒),调整启动超时阈值 - 完善内存配置:取消
-Xmx512m和-XX:MaxMetaspaceSize=256m的注释,确保服务器有足够内存资源
内容的提问来源于stack exchange,提问作者Lore
相关产品推荐
相关产品推荐

