【问题标题】:Deploy to root in wildfly in docker在 docker 中部署到 wildfly 的 root
【发布时间】:2020-09-04 01:39:46
【问题描述】:

Dockerfile

FROM jboss/wildfly
COPY target/TimeTable-1.0-SNAPSHOT.war /opt/jboss/wildfly/standalone/deployments/

Docker-compose.yml

version: '3'

services:
  wildfly:
    image: jboss/wildfly
    container_name: wildfly
    ports:
      - "8080:8080"
      - "9990:9990"
  timetable:
    build: .
    depends_on:
      - wildfly

webapp/WEB-INF/jboss-config.xml

<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee" version="8.0">
    <context-root>/</context-root>
</jboss-web>

如果我亲自部署到主机上的 Wildfly,一切都会按预期运行,并且在根页面上我会看到我的 index.xhtml。但是当我将它部署到 docker 时,localhost:8080/ 会显示默认的 Wildfly 欢迎页面。在 docker 的日志中,我看到 Registered web context: '/' for server 'default-server',但仍然没有任何变化

【问题讨论】:

    标签: java docker wildfly


    【解决方案1】:

    文件名为jboss-web.xml。我和你有不同的命名空间,但我相信它只是文件名。我有:

    <?xml version="1.0" encoding="UTF-8"?>
    <jboss-web version="10.0"
               xmlns="http://www.jboss.com/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-web_10_0.xsd">
    
        <context-root>/</context-root>
    </jboss-web>
    

    【讨论】:

      猜你喜欢
      • 2015-07-20
      • 2015-05-29
      • 1970-01-01
      • 2015-11-21
      • 1970-01-01
      • 2017-03-12
      • 1970-01-01
      • 2018-11-21
      • 1970-01-01
      相关资源
      最近更新 更多