【问题标题】:Deploy Java EE application as root context on WildFly在 WildFly 上将 Java EE 应用程序部署为根上下文
【发布时间】:2015-08-16 16:44:44
【问题描述】:

我正在使用 Eclipse Mars IDE + JBoss AS (WildFly 9.0.1)。然后我启动服务器,一切正常。我想知道如何将应用程序设置为根上下文? 要运行我的应用程序,我必须这样做: http://localhost:8080/demoApp,但我只想做:http://localhost:8080/

下面是文件代码的片段:standalone.xml。 我修改了它,如下所示,但我得到:403 - Forbidden,当转到:http://localhost:8080/。请记住,WildFly 服务器是使用 Eclipse 调试器启动的,因为我处于开发模式。

...
<subsystem xmlns="urn:jboss:domain:undertow:2.0">
    <buffer-cache name="default" />
    <server name="default-server">
        <http-listener name="default" socket-binding="http"
            redirect-socket="https" />
        <host name="default-host" alias="localhost">
            <location name="/" handler="demoApp" />
            <filter-ref name="server-header" />
            <filter-ref name="x-powered-by-header" />
        </host>
    </server>
    <servlet-container name="default">
        <jsp-config />
        <websockets />
    </servlet-container>
    <handlers>
        <file name="welcome-content" path="${jboss.home.dir}/welcome-content" />
        <file name="demoApp" path="${jboss.home.dir}/standalone/deployments/demoApp.war" />
    </handlers>
    ...

【问题讨论】:

    标签: eclipse jakarta-ee jboss wildfly


    【解决方案1】:

    一个更好的选择是添加

    <context-root>/</context-root>
    

    进入 jboss-web.xml

    【讨论】:

      【解决方案2】:

      只需部署为 ROOT.war 并在standalone.xml 中禁用默认的根 Web 应用程序,记录器会告诉您要更改的配置属性的名称

      【讨论】:

        猜你喜欢
        • 2014-05-23
        • 1970-01-01
        • 2018-09-08
        • 1970-01-01
        • 2013-03-16
        • 2011-06-17
        • 2015-04-15
        • 2014-07-29
        • 1970-01-01
        相关资源
        最近更新 更多