Java Jboss 在根上下文中部署

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21957060/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 11:38:29  来源:igfitidea点击:

Jboss deploying in root context

javaspringmavenjboss

提问by user3260950

Yes, i know about enable-welcome-root=false, but cant find this in files. Use wildfly final or jboss eap 6.2. Where it is? And why i need to add jboss-web.xml in WEB-INF?

是的,我知道enable-welcome-root=false,但在文件中找不到。使用 wildfly final 或 jboss eap 6.2。在哪儿?为什么我需要在 WEB-INF 中添加 jboss-web.xml?

采纳答案by ltalhouarne

The file in question is standalone.xml and is located in the following directory:

有问题的文件是 standalone.xml 并位于以下目录中:

%JBOSS_HOME%/configuration/standalone.xml

You need to add enable-welcome-root=falsein your virtual server definition in your standalone:

您需要enable-welcome-root=false在独立的虚拟服务器定义中添加:

<virtual-server name="localhost" enable-welcome-root="false">

And create a jboss-web.xml file with the following:

并使用以下内容创建一个 jboss-web.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>

<jboss-web>
    <context-root>/</context-root>
</jboss-web>

回答by Mark O'Connor

And building on the answer provided by BelgianMyWaffle.

并以 BelgianMyWaffle 提供的答案为基础。

While J2EE defines the execution environment of a Java app it does not mandate how application servers are configured, so each has their own way to customize behaviour.

虽然 J2EE 定义了 Java 应用程序的执行环境,但它并不强制要求如何配置应用程序服务器,因此每个应用程序服务器都有自己的自定义行为方式。

The following describes the jboss-web.xml:

下面介绍jboss-web.xml:

The jboss-web.xml is an XML file containing the JBossWeb specific behaviour of a webapp. It replaces the Tomcat context.xml file. You need only to use it if you want properties and behaviour that extent the web.xml of the Servlet 3.0 specifications.

jboss-web.xml 是一个 XML 文件,其中包含 Web 应用程序的 JBossWeb 特定行为。它替换了 Tomcat context.xml 文件。仅当您想要扩展 Servlet 3.0 规范的 web.xml 的属性和行为时才需要使用它。

And the following lists all the various mechanisms supported by wildfly for customizing application deployment

以及下面列出了wildfly支持的各种自定义应用部署的机制

JBoss Web deployment descriptor. This can be use to override settings from web.xml, and to set WildFly specific options

JBoss Web 部署描述符。这可用于覆盖 web.xml 中的设置,并设置 WildFly 特定选项

回答by user3260950

Solution: Clean wildfly server, new clean project, just added jboss-web.xml to WEB-INF. Normal deploying and everything works fine.

解决方法:清理wildfly服务器,新建清理工程,只是在WEB-INF中添加了jboss-web.xml。正常部署,一切正常。