部署时未侦听Wildfly Http接口



上下文:我正试图在同一服务器内部署两个工件appA.war和appB.war。在启动期间,appB向appA发出http请求,因此appB.war在启动时依赖于另一个,所以我在jboss-all.xml 中声明了该依赖关系

<jboss umlns="urn:jboss:1.0">
<jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:deployment-dependencies:1.0 ">
<dependency name="appA.war"/>
</jboss-deployment-dependencies>

问题:依赖关系规则按预期工作。但在容器重新启动期间,http请求会被拒绝,即使我无限重试。只有在wildfly完成后,才会处理请求。在部署扫描过程中,该接口似乎未设置或已禁用。我在我的日志上发现了这个

2021-04-24 13:52:53,846 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0003: Undertow 2.2.5.Final starting
2021-04-24 13:52:53,967 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 74) WFLYUT0014: Creating file handler for path '/opt/wildfly/develop/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
2021-04-24 13:52:53,976 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0012: Started server default-server.
2021-04-24 13:52:53,977 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) Queuing requests.
2021-04-24 13:52:53,978 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0018: Host default-host starting
2021-04-24 13:52:54,044 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0006: Undertow HTTP listener default listening on 0.0.0.0:8081
2021-04-24 13:52:54,170 INFO  [org.jboss.as.ejb3] (MSC service thread 1-5) WFLYEJB0493: Jakarta Enterprise Beans subsystem suspension complete
2021-04-24 13:52:54,249 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
2021-04-24 13:52:54,324 INFO  [org.jboss.as.patching] (MSC service thread 1-8) WFLYPAT0050: WildFly Full cumulative patch ID is: base, one-off patches include: none
2021-04-24 13:52:54,352 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-7) WFLYDS0013: Started FileSystemDeploymentService for directory /opt/wildfly/develop/standalone/deployments
2021-04-24 13:52:54,356 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0027: Starting deployment of "appA.war" (runtime-name: "holiday.war")
2021-04-24 13:52:54,359 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "appB.war" (runtime-name: "configuracion.war")
2021-04-24 13:52:54,478 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0006: Undertow HTTPS listener https listening on 0.0.0.0:8444
2021-04-24 13:52:54,531 INFO  [org.jboss.ws.common.management] (MSC service thread 1-2) JBWS022052: Starting JBossWS 5.4.3.Final (Apache CXF 3.3.10)

你知道怎么解决这个问题吗?或者有什么解决办法?

服务器在完成引导之前不接受外部连接是意料之中的行为。你可以选择尝试

  • 禁用此行为(我不建议(

  • 在未部署应用程序的情况下启动服务器。然后使用cli 逐个部署

  • 只需运行两个不同的服务器实例,每个有一个应用程序

或者,如果你知道两个应用程序总是在同一台服务器上,那么就切换到vm内调用,比如进行ejb调用,而不是http,这对于同一jvm中的两个项目来说是一种效率低得多的通信方式

我相信你正在寻找https://issues.redhat.com/browse/WFCORE-4291在WF 23 中引入

最新更新