【问题标题】:Tomcat index.html blank page 404Tomcat index.html 空白页 404
【发布时间】:2014-09-08 20:56:38
【问题描述】:

http://localhost:8080/正确返回正常的tomcat管理页面。

我的主机文件:

127.0.0.1 接口

http://api:8080/index.html 得到一个空白页(萤火虫报告 404)

我的应用程序位于单独的位置:/html/API/API

我将此添加到 server.xnl

  <Host name="api"  
        unpackWARs="true" autoDeploy="true"
        appBase="/html/API/API/web" >
  </Host>

我的 web.xml 是:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
</web-app>

index.html的路径是:/html/API/API/web/index.html

我在 Netbeans 中进行了设置,如果这有影响的话。

我似乎无法摆脱这个空白页面并正确显示 index.html

编辑: 这有效:

  <Host name="api"  
        unpackWARs="true" autoDeploy="true"
        appBase="/html/API/API/dist" >
       <Context path="/" docBase="/html/API/API/build/web" reloadable="true">
       </Context>
  </Host>

【问题讨论】:

    标签: tomcat


    【解决方案1】:

    您的主机的appBase 是Tomcat 查找此虚拟主机可用的所有Web 应用程序的位置。因此,对于您的 api 虚拟主机,它相当于 webapps 目录。因此,您应该将战争文件或分解的战争文件放在此目录中,而不是您的 index.html。

    如果您想为这个虚拟主机提供一个应用程序,从根上下文提供服务,然后将其命名为 ROOT.war(或 ROOT,如果您部署了分解的 war 文件):

    /html/API/API/web/ROOT/index.html
    

    详情请见http://tomcat.apache.org/tomcat-7.0-doc/config/host.html

    【讨论】:

    • 我看到:/html/API/API/dist/API/API.war (也在那里爆炸)我已经指出 appBase="/html/API/API/dist/API" 但是仍然遇到同样的问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-24
    • 2015-10-15
    • 2012-06-15
    • 1970-01-01
    • 1970-01-01
    • 2011-02-07
    • 1970-01-01
    相关资源
    最近更新 更多