首页 > 解决方案 > 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)

你知道如何解决这个问题吗?或任何解决方法?

标签: jbosswildfly

解决方案


服务器在完成启动之前不接受外部连接是预期的行为。你可以另类尝试

  • 禁用此行为(我不推荐)

  • 启动没有部署应用程序的服务器。然后使用cli一个一个部署

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

或者,如果您知道两个应用程序始终位于同一服务器上,请切换到 in-vm 调用,例如进行 ejb 调用而不是 http,这对于同一 jvm 中的两个项目进行通信的效率要低得多


推荐阅读