解决 Wildfly 启动超时(concurrent timeout)

问题

在做项目的过程中,由于项目比较庞大,并且使用了 VPN 导致网络较差。在启动时经常报启动超时的错误,错误详情如下:

1
2
3
4
5
6
7
8
16:38:04,388 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0348: Timeout after [300] seconds waiting for service container stability. Operation will roll back. Step that first updated the service container was 'add' at address '[
("core-service" => "management"),
("management-interface" => "http-interface")
]'
16:38:05,642 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) WFLYJCA0019: Stopped Driver service with driver-name = Aerobay.war_com.mysql.jdbc.Driver_5_1
16:38:09,548 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0190: Step handler org.jboss.as.server.DeployerChainAddHandler$FinalRuntimeStepHandler@5f88823f for operation {"operation" => "add-deployer-chains","address" => []} at address [] failed handling operation rollback -- java.util.concurrent.TimeoutException: java.util.concurrent.TimeoutException
at org.jboss.as.controller.OperationContextImpl.waitForRemovals(OperationContextImpl.java:396)
......

从错误信息里面可以看出来,wildfly 在 300 秒内没有启动成功,导致 wildfly 自动停止启动。

解决方案

可以适当延长 wildfly 启动时间限制,比如把默认的 300 秒调成 600 秒。

在 standalone.bat 中增加一行配置:

set "JAVA_OPTS=%JAVA_OPTS% -Djboss.as.management.blocking.timeout=600

如果使用 ide 开发工具的话,可以在 wildfly 配置页面增加一行配置:(这边以 IDEA 为例)

-Djboss.as.management.blocking.timeout=600