首页 文章

在WildFly上将Java EE应用程序部署为根上下文

提问于
浏览
0

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

下面是文件代码的片段: standalone.xml . 我修改了它,你可以在下面看到,但我得到:403 - 禁止进入: 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>
    ...

2 回答

  • 1

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

  • 0

    一个更好的选择是添加

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

    进入jboss-web.xml

相关问题